Files
vercel__workflow/.changeset/jk-nav-autoscroll.md
Mitul Shah 8f6973319d [web-shared] Auto-scroll trace viewer on J/K span navigation (#2366)
* [web-shared] Auto-scroll trace viewer on J/K span navigation

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>

* [web-shared] Extract scrollRowIntoView helper from trace viewer

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>

* Update trace-viewer.tsx

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:17:10 -07:00

224 B

@workflow/web-shared
@workflow/web-shared
patch

Auto-scroll the trace viewer when navigating spans with the J/K keys (or the up/down chevrons) so the newly-selected span is always revealed when it falls outside the visible area.