fix(web-ui): stabilize flow chat viewport anchoring - #1821
Merged
Conversation
- centralize pinned-item, tail-follow, and preserved-element behavior in a semantic viewport coordinator - synchronize footer reservations with streaming growth and tool-card collapse transactions - preserve tool-card header positions through the shared height contract - handle virtualizer compensation, late scroll clamping, and pinned-to-tail handoff - add focused regression tests and update scroll stability documentation
wsp1911
marked this pull request as ready for review
July 28, 2026 08:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1578
Type and Areas
Type:
Regression fix
Areas:
Web UI, Flow Chat, virtualized message list, tool cards
Motivation / Impact
New user messages could briefly lose their pinned position or permanently fall away from the top while assistant output was streaming. Automatic tool-card collapse could also move the card header because Virtuoso, footer compensation, and follow-output behavior independently adjusted the viewport.
This change gives viewport ownership to a semantic coordinator and makes bottom-range reservation part of the list's internal behavior. New turns remain pinned until they can safely transition to tail-follow mode, while collapsing tool cards retain a stable header position without requiring card-specific offset calculations.
Verification
pnpm run type-check:web— passedpnpm --dir src/web-ui run test:run src/flow_chat/components/modern/VirtualMessageList.session-boundary.test.tsx src/flow_chat/components/modern/FlowChatViewportCoordinator.test.ts src/flow_chat/tool-cards/useToolCardHeightContract.test.tsx src/flow_chat/tool-cards/TodoWriteDisplay.test.tsx— 4 files and 38 tests passedgit diff --check— passedTodoWrite,Write, automatic collapse, turn start, and turn completion.Reviewer Notes
The main review surface is the ownership boundary between semantic anchors, Virtuoso scroll compensation, footer reservations, and streaming tail-follow behavior.
Tool cards use a generic collapse contract; the virtualized list does not contain tool-name-specific handling. Temporary diagnostic instrumentation and debug logs are not included.
No user-facing strings, locale resources, or external contracts were changed.
Checklist