Uh oh!
There was an error while loading. Please reload this page.
fix(web): fix inaccurate scroll position when selecting chat references - #1035
Conversation
…es (SOU-724) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughUpdated scroll positioning for selecting file references: the flow now instantly brings the file into the viewport, then uses CodeMirror's coordsAtPos on the next animation frame to compute and center the precise line inside the ScrollArea. Also added border styling for selected references without a range and a changelog entry. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as "Ask UI\n(Component)"
participant ScrollArea as "ScrollArea\n(Container)"
participant Viewport as "Browser\nViewport"
participant CM as "CodeMirror\n(view)"
UI->>ScrollArea: Request scroll to selected reference
alt file collapsed
UI->>UI: Expand file (instant)
end
UI->>Viewport: element.scrollIntoView({behavior: 'instant'})
Note right of Viewport: File element is now in viewport
Viewport->>CM: nextAnimationFrame -> request coordsAtPos(pos)
CM-->>ScrollArea: return line coordinates (accurate)
ScrollArea->>ScrollArea: instant scroll to center the computed line
ScrollArea-->>UI: scroll complete
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
Summary
lineBlockAtto a two-step scroll usingcoordsAtPos. CodeMirror 6 virtualizes line rendering and returns estimated positions for off-screen lines; the first step instantly scrolls the file into the browser viewport so CodeMirror renders and measures the target lines, then the second step scrolls precisely to the correct line.--chat-reference-selected-bordercolor token.Fixes#1034
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit