Repository navigation
fix(site/src/pages/AgentsPage/components/ChatConversation): move focus the turn's fold removes to its summary - #31138
Closed
ibetitsmike wants to merge 4 commits into
Conversation
…s the turn's fold removes to its summary When a turn ends, its fold starts collapsed and takes in the turn's earlier blocks and the text between them. A control focused there unmounted, and focus fell to the page body. FoldFocusRestorer now focuses the summary of the fold that holds the focused item's rows. A block that only the stream had has no persisted rows yet, so it matches the rows that the stream persisted as the turn ended.
… newest row only once focus is lost FoldFocusRestorer's snapshot runs on every timeline render while focus sits in the timeline, including each streamed chunk, but it needs the newest rendered row only when focus is lost from the live row. It now reads that row from the previous props in componentDidUpdate.
… the fold focus records and test fixtures
… the fold focus match for both of its cases
This was referenced Oct 21, 2026
Closed
Collaborator
Author
|
Folded into #30656: its single commit, rebased onto
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Stacked on #31025, which folds each finished turn into one Working block that starts collapsed.
When a turn ends, its fold takes in the turn's earlier blocks and the text between its steps and collapses, so whatever the reader had focused there unmounts and focus falls to the page body. A keyboard or screen reader user loses their place. This happens when the reader had focused a control in an expanded earlier block, a link in text between steps, a control in the turn's last block, or the summary of a block that only the stream had when the turn ended.
Focus now moves to the summary of the fold that holds what the reader had focused. Focus that survives the fold, and focus lost while a turn runs, is left alone.
Review notes
FoldFocusRestoreris a class component because onlygetSnapshotBeforeUpdatesees the focused element before React commits the fold; a layout effect runs after the element is gone.data-message-idand focuses the first ended-turn block whose persisted message IDs include one of that item's. A block that only the stream had has no persisted rows; its content persists as messages newer than any rendered before, so it matches the fold that holds one of those.d323d2b9deb:frontend-deep-reviewpasses all eight roles after three rounds, the test audit passes, andfrontend-reviewFE1 to FE10 pass. The pre-commit hook, the unit tests insrc/pages/AgentsPage,src/vendor, andsrc/testHelpers(the only failures are inProjectChatsList.test.tsx, which fails the same way without this PR), and the ChatConversation story tests pass. Each case of the new test fails without the restorer, and the stream-only case also fails without the newer-rows match.