Repository navigation
fix(traffic): arrow keys follow the rows on screen when grouped by session - #115
Merged
Merged
Conversation
…ssion The keyboard cursor was an index into `rows`, the filtered and sorted list. In the grouped view that is not what is on screen: sessions are ordered by their newest request, a session lists its requests oldest first, and requests in collapsed sessions are not rendered. So Down moved the highlight up within a session, jumped between sessions and landed on rows that were not in the table; with the sessions collapsed, which is how the grouped view opens, it highlighted nothing at all. - The cursor remembers which row it is on (a request id, or a session header) instead of a position. New requests arriving at the top, another sort, or a session expanding above no longer move the highlight to a different request. - Up/Down walk the rows in the order they are drawn (`lines` in grouping.ts, next to the grouping it mirrors), skipping requests in collapsed sessions. A cursor left inside a session that was then collapsed continues from where that row was. - Session headers are rows too: Enter opens the session, Right expands it, Left collapses it, and Left on a request inside a session moves to its header, as in a Finder list view. Clicking a header puts the cursor there, as clicking a request already did. - Header rows get the same scroll margins as request rows, so they stop below the pinned header and never scroll the table sideways; the margins now sit on the table for every body row. - The effect that pulled an index back when the list got shorter is gone: a request that leaves the list simply loses the highlight, and the next key press starts from the first row. Co-Authored-By: Claude Opus 5 <noreply@anthropic.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.
Follow-up to #111. The keyboard cursor in the traffic table was an index into
rows, the filtered and sorted list. In the grouped view that is not what is on screen: sessions are ordered by their newest request, a session lists its requests oldest first, and requests in collapsed sessions are not rendered. Measured with about 200 rows in four sessions:What changes
lines()ingrouping.tslists them the wayRequestRowslays them out (a comment on each side points at the other), including the requests of collapsed sessions, marked as not shown;step()moves to the next shown row and stays put at either end. A cursor left on a request whose session was then collapsed continues from where that request was: ↓ goes to the first row below the session, ↑ to its header.In the flat view the keys walk the same rows as before; the one difference is that the highlight stays on its request when new ones arrive.
Verification
Unit tests for
linesandstep: the order in the flat and grouped views, skipping collapsed sessions, both ends, a cursor left in a collapsed session (including the last one), and an empty table.Isolated preview (mocked IPC, full
Appon the traffic page), in Chromium and in the system WKWebView (offscreen, the engine Tauri uses on macOS). The probe from #111 now also checks that every press moves the highlight by exactly one row, in the direction of the key. Grouped view with all four sessions expanded (207 rows), 820×560, light and dark: in WebKit down the whole list and back fromscrollLeft0, 100 and the far right; in Chromium the whole list from 0, and 40 presses each way from 100 and the far right:scrollLeftWith real key events (
NSEventin the WKWebView): on a collapsed header → expands it (190 → 207 rows), ↓ ↓ reaches its second request, ← goes back to the header, ← again collapses it (207 → 190), Enter opens the session drawer and Esc closes it;scrollLeftstays 0 throughout, so ← and → did not also scroll the table. In Chromium (CDP keys), Enter on a request inside a session opens the request drawer and Enter on a header opens the session drawer. With only headers on screen, ↓ steps through the four headers and stops at the last.With the cursor on the sixth row of the flat view, a new request arriving at the top leaves the highlight on the same request, now seventh, and ↓ continues from it. The flat view's walk from #111 gives the same numbers as before.
The header highlight shows in both themes:
neutral-100over the headers'neutral-50/60(light),neutral-800overneutral-900/40(dark).pnpm typecheck,pnpm test(228 passed) andpnpm buildpass on top of #110.🤖 Generated with Claude Code