Skip to content

fix: keep agent work expansions anchored - #72

Merged
morgmart merged 2 commits into
mainfrom
agent-work-scroll
Aug 18, 2026
Merged

fix: keep agent work expansions anchored#72
morgmart merged 2 commits into
mainfrom
agent-work-scroll

Conversation

@morgmart

@morgmart morgmart commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

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.

Before: expanded Agent Work tool output fills the transcript

After

Tool details stay compact in a keyboard-accessible scroll region while the expanded Agent Work row remains anchored.

After: expanded Agent Work tool output is capped and scrollable

@morgmart
morgmart requested a review from a team August 17, 2026 22:02
@kalvinnchau kalvinnchau changed the title keep agent work expansions anchored fix: keep agent work expansions anchored Aug 18, 2026
@morgmart
morgmart merged commit a3ffa3e into main Aug 18, 2026
9 checks passed
@morgmart
morgmart deleted the agent-work-scroll branch August 18, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants