[DRAFT] [web-shared] Auto-scroll trace viewer on J/K span navigation#2366
Draft
mitul-s wants to merge 2 commits into
Draft
[DRAFT] [web-shared] Auto-scroll trace viewer on J/K span navigation#2366mitul-s wants to merge 2 commits into
mitul-s wants to merge 2 commits into
Conversation
Bring the selected span into view when J/K (or the up/down chevrons) navigate to a span outside the visible area. The event list is windowed with fixed-height rows, so the target offset is computed from the row index rather than relying on a DOM node that may not be mounted. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
🦋 Changeset detectedLatest commit: 9d5c167 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Relocate the J/K auto-scroll geometry math out of the large NewTraceViewerContent component and into a small pure helper colocated with the windowing primitives in use-row-window.ts. scrollRowIntoView reuses the existing getScrollParent walker and takes the row height as a parameter, so the trace viewer's scrollSpanIntoView is now a thin caller that finds the span index and delegates. No behavior change: the off-screen-only condition, one-row margin, clamp to [0, scrollHeight - clientHeight], and reduced-motion behavior are all preserved. getScrollParent(#event-list) resolves to the same SplitPane scroll container the old code measured against directly, so the net scroll geometry is identical. Co-authored-by: Cursor <cursoragent@cursor.com>
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
J(next) /K(prev) keys — or the up/down chevron buttons — the view now auto-scrolls so the newly-selected span is revealed if it falls outside the visible area.ROW_HEIGHT_PX) rows, so off-screen rows have no DOM node toscrollIntoView. The target scroll offset is computed from the span's row index within the sharedSplitPanescroll container, scrolling just enough to reveal it plus one row of margin (block: 'nearest'-style).useReducedMotion(autovssmoothscroll behavior).Changes
packages/web-shared/src/components/new-trace-viewer/trace-viewer.tsxTest plan
J/Krepeatedly and confirm the selection scrolls into view at both the top and bottom edges.Made with Cursor