fix: keep agent work expansions anchored - #72
Merged
Merged
Conversation
kalvinnchau
approved these changes
Aug 18, 2026
3 tasks
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.
Category: fix
User Impact: Expanded agent work stays visually anchored, while long tool details remain compact and can be scrolled with a pointer or keyboard.
Problem: Long tool-call details made Agent Work difficult to scan, and opening the surrounding Previous steps disclosure could make the virtual transcript jump toward the bottom. The compact details region also needed an accessible keyboard-scrolling path.
Solution: Cap Agent Work tool details in a labeled, focusable scroll viewport, pin user-opened Agent Work disclosures to their transcript row, and only auto-follow measured height changes while the virtualizer still owns a bottom anchor.
File changes
src/features/chat/ui/AgentWorkPanel.tsx
Pins the virtual transcript anchor before either Agent Work disclosure changes height, preserving the reader’s position.
src/features/chat/ui/ToolCallAdapter.tsx
Places Agent Work tool details inside the shared compact scroll viewport and supplies its localized accessible label.
src/features/chat/ui/VirtualMessageTimeline.tsx
Prevents measured-height bottom-follow from overriding a row anchor established by user interaction.
src/features/chat/ui/tests/ToolCallAdapter.test.tsx
Covers the Agent Work-only height cap, scrolling behavior, region label, and keyboard focusability.
src/features/chat/ui/tests/VirtualMessageTimeline.test.tsx
Protects the regression where expanding and remeasuring an Agent Work row forced the transcript toward the bottom.
src/shared/i18n/locales/en/chat.json
Adds the English accessible label for tool details.
src/shared/i18n/locales/es/chat.json
Adds the Spanish accessible label for tool details.
src/shared/ui/ai-elements/tool.tsx
Adds a reusable focusable tool-details viewport with the shared focus treatment.
Screenshots
Before
Long tool output expands the Agent Work row beyond the viewport.
After
Tool details stay compact in a keyboard-accessible scroll region while the expanded Agent Work row remains anchored.