Skip to content

fix(ui): keep scrollbar thumbs one width with a minimum length - #1069

Merged
PathGao merged 1 commit into
masterfrom
fix/scrollbar-thumb
Nov 8, 2026
Merged

PathGao merged 1 commit into
masterfrom
fix/scrollbar-thumb

Conversation

@PathGao

@PathGao PathGao commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Closes #1063. The scrollbar thumbs grew from 8px to 12px under the pointer, were fully rounded, and in a long document the preview's shrank to a dot.

Both thumbs now follow Monaco's own slider instead of the issue's exact numbers:

  • One width, 12px on the existing 14px track (today's hover width, so the grab area never shrinks). Hover and drag only darken the colour, as Monaco's slider does. The editor's width overrides are removed rather than adjusted. The resting colour is unchanged; VS Code ships a 14px thumb at about the same alpha.
  • A 4px corner, Fluent's borderRadiusMedium, instead of a pill.
  • A 20px minimum length, Monaco's MINIMUM_SLIDER_SIZE. It is a constant, not an option, so the preview uses the same number through min-height on ::-webkit-scrollbar-thumb. WebKit honours it (the thumb is 15px without it). Chromium already keeps its thumb at 24px, so on WebView2 the preview's minimum is 24px against the editor's 20px.

Verified: npm run check, npm run lint, both test suites, cargo test --locked, fmt and clippy pass. Measured in Chromium (editor and preview, rest and hover: 12px wide, 4px corner, width unchanged on hover) and in an offscreen WKWebView (preview: 12px, 20px minimum). Not checked: hover colour in WebKit, and real WebView2 on Windows.

The thumbs grew from 8px to 12px under the pointer, were fully rounded,
and in a long document the preview's shrank to a dot (#1063). Both now
follow Monaco's own slider: one width at rest and under the pointer,
with hover and drag only darkening the color, and a minimum length.

- Width: 12px on the existing 14px track, today's hover width, so the
  grab area never shrinks. The rest color stays rgba(120,120,120,0.35);
  VS Code ships a 14px thumb at about 0.4 alpha.
- Corner: 4px, Fluent's ControlCornerRadius / borderRadiusMedium
  (@fluentui/tokens), not a pill at 12px.
- Minimum length: 20px, Monaco's MINIMUM_SLIDER_SIZE (monaco-editor
  0.55.1, base/browser/ui/scrollbar/scrollbarState.js). It is a constant,
  not an editor option, so the preview uses the same number: min-height
  22px on ::-webkit-scrollbar-thumb is 20px inside the 1px transparent
  border. WebKit honors it (15px without it); Chromium already keeps
  its thumb at 24px visible, so there it changes nothing.
- Hover: Monaco's slider only swaps scrollbarSlider.background for
  hoverBackground/activeBackground. The width overrides that grew the
  editor's slider are removed rather than adjusted.
@PathGao
PathGao merged commit 09150c8 into master Nov 8, 2026
4 checks passed
@PathGao
PathGao deleted the fix/scrollbar-thumb branch November 8, 2026 06:36
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