Skip to content

Stop scrollbars appearing and disappearing across the console - #339

Merged
athNdev merged 2 commits into
mainfrom
fix/scroll-jitter
Nov 4, 2026
Merged

athNdev merged 2 commits into
mainfrom
fix/scroll-jitter

Conversation

@athNdev

@athNdev athNdev commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Fixes the choppy behaviour caused by scrollbars toggling, and removes them from surfaces that should never show one.

Why it flickered

A classic scrollbar is ~17px. When content crosses the overflow threshold the bar appears, the content box narrows, text rewraps taller — which can push the other axis over its threshold and pull the bar back out. Each toggle reflows the layout, so the sequence repeats.

Measured in the browser against the built CSS, before/after on a container whose content toggles 299px ↔ 301px:

content width without overflow with overflow shift
before (gutter: auto) 300px 289px 11px
after (gutter: stable) 289px 289px 0px

What changed

One scrollbar look, and a thin one. app.css sets scrollbar-width: thin and a Carbon thumb colour globally, with a ::-webkit-scrollbar fallback for browsers without the standard properties.

Vertical scrollers reserve their gutter. A single :where(.overflow-y-auto, .overflow-y-scroll, .overflow-auto) rule applies scrollbar-gutter: stable wherever Tailwind's overflow utilities are used, so nobody has to remember a class. overflow-x-auto table wrappers are deliberately not matched, so tables are not inset.

Tab strips never show a bar. CarbonTabs and the bits-ui tab list now use a scroll-strip utility (overflow-x: auto; overflow-y: hidden; scrollbar-width: none). The server view strip had overflow-x-auto, so a narrow window grew a horizontal bar inside the bar and changed its height; that class is gone from the page and from Settings.

Tabs cannot shrink or wrap, so the strip height is constant. Measured with 12 tabs at 600px and at 380px: strip height 41px in both, scrollbar-width: none, overflow present.

The selection indicator stays inside the strip. It was at bottom-[-1px], which the strip's hidden vertical overflow would clip; it now sits on the strip's inner bottom edge, exactly over the selected tab's 2px border.

The indicator re-measures from a ResizeObserver on the strip instead of window.resize. A sidebar collapse, a zoom change or a badge appearing changes the strip's layout without firing a window resize, which left the indicator parked under the previously selected tab. Verified in the running console: after a CSS zoom to 1.15 the indicator tracked the tab (left 181px, button left 181px).

Verification

  • Real component in a running dev server: 12 tabs, overflow true, strip 41px, no bar; indicator aligned to the selected tab at 600px, 380px and after zoom.
  • Static fixture against the built CSS: strip height identical with and without overflow; gutter stable = 0px shift, control = 11px shift.
  • svelte-check 0 errors/0 warnings, bun run test 63 pass, knowledge-lint 10/10.
  • New guards: CarbonTabs.test.ts (strip utility present, tabs shrink-0 + nowrap, indicator not clipped) and scrollbar-policy.test.ts (thin global scrollbars, gutter rule, strip utility, opt-out utility, WebKit fallback).

A classic scrollbar changes the content box when it appears, which can
rewrap the content taller, pull the neighbouring axis over its threshold and
make the bar vanish again. The console now has one thin scrollbar look, and
every vertical scroll container reserves its gutter, so an overflow change
cannot reflow anything beside it.

Tab strips no longer show a bar at all. The server view strip was
overflow-x-auto, so a narrow window grew a horizontal bar inside the bar and
changed its height; it now uses the scroll-strip utility, which scrolls but
never draws a bar. Tabs no longer shrink or wrap, so the strip height cannot
change with the window, and the selection indicator sits on the strip's inner
edge where the hidden overflow cannot clip it.

The indicator also re-measures from a ResizeObserver on the strip instead of
window resize, so a sidebar collapse or a zoom change no longer leaves it
parked under the previously selected tab.
@athNdev
athNdev merged commit 03f97f4 into main Nov 4, 2026
11 checks passed
@athNdev
athNdev deleted the fix/scroll-jitter branch November 4, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant