Repository navigation
fix(traffic): keep the table header pinned while the list scrolls - #108
Merged
Merged
Conversation
The header has carried `sticky top-0` since #8, but it stopped sticking in #15, when it moved inside shadcn's `Table`. That component wraps the table in a div with `overflow-x: auto`, and a box that scrolls on one axis is a scroll container on both: the other axis's `visible` computes to `auto`. The header stuck to that div, which never scrolls vertically, so it went up with the rows. 600px down the list it sat 540px above the top of the scroller. `Table` gets a `scroll` prop. The request table turns it off, so the header sticks to the page's scroller instead. The wrapper was doing real work, though. At the minimum window width with the sidebar expanded the table is 808px in a 584px column, and without the wrapper the page's scroller takes the horizontal overflow too, which would slide the filter bar sideways with the table. So the page is split into three blocks. The filter bar (with the no-upstream notice) and the footnote are direct children of the scroller with `sticky left-0`: that makes them exactly as wide as what is visible, and they stay put while the table scrolls sideways. The table sits in a `w-fit min-w-full` block that grows with it, so its right padding still scrolls into view. The horizontal scrollbar now sits at the bottom of the window rather than under the last of two hundred rows. Two things only showed once the header actually stuck: - The table uses collapsed borders, and a collapsed border is painted by the table, not the row, so the line under the header stayed behind and scrolled away with the rows. The header cells draw it as an inset shadow instead, which moves with them. - The header's background was neutral-50/950, which no longer matches the window ground (#f7f8fa / #0c0e11); rows passing under it would show a band. It uses `bg-background` now. Not taken: pinning the filter bar above a table that scrolls on both axes costs 60-96px of list height at every window size, about two rows; `overflow-x: clip` cuts off the cost column at the minimum width. Also points three comments that still sent readers to `Split`, removed in #82, at the scroll layer that exists now. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 22, 2026
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.
The traffic table's header is meant to stay pinned while the list scrolls (the comment above it says so), but it scrolls away with the rows.
Why it broke
It worked in #8, when the header was a raw
<thead>in a plain<table>. #15 moved it inside shadcn'sTable, which wraps the table in<div data-slot="table-container" class="relative w-full overflow-x-auto">. A box that scrolls on one axis is a scroll container on both (the other axis'svisiblecomputes toauto), so that div became the header's sticky scroll container. It never scrolls vertically, so the header never sticks. Measured before this change: 600px down the list, the header sat 540px above the top of the scroller.What changes
Tablegets ascrollprop (defaulttrue, so every other table keeps scrolling sideways on its own). The request table passesscroll={false}, and the header sticks to the page's scroller.sticky left-0. As direct children they are exactly as wide as the visible area, and they stay put while the table scrolls sideways;w-fit min-w-fullblock that grows with it, so the 20px right padding still scrolls into view.The top padding stays on an inner block, not on the scroller, as in fix(traffic): leave room between the title bar and the filter bar #106.
neutral-50/neutral-950, which no longer matches the window ground (#f7f8fa/#0c0e11); rows passing under it would show a band. It usesbg-background.Split(removed in Fold requests and sessions into one table #82) as the place the traffic page scrolls; they now point at the scroll layer that exists.A side effect worth knowing: the horizontal scrollbar is now at the bottom of the window instead of under the last of up to two hundred rows.
Alternatives not taken
overflow-x: clipon the wrapper. Not a scroll container, so the header would stick, but at the minimum width it cuts off the last 224px, which is the token and cost columns.Verification
Measured from the DOM in the isolated preview (mocked IPC, full
Appon the traffic page) in Chromium, and in the system WKWebView (offscreen, the engine Tauri uses on macOS). Flat and grouped (two sessions expanded), 820×560 and 1100×720, light and dark:overflow-x/overflow-yIn WebKit, a pixel sample across the header's bottom edge shows the rule at the same place at rest and when stuck (dark: 50 on a 17 ground; light: 234 on 250); before the shadow change it vanished once the header stuck. At 1100×720 the flat table fits (no horizontal scroll). The no-match empty state renders below the filter bar at the visible width with no horizontal overflow.
pnpm typecheck,pnpm test(197 passed) andpnpm buildpass.🤖 Generated with Claude Code