orca icon indicating copy to clipboard operation
orca copied to clipboard

fix(sidebar): only show the projects scrollbar when the list overflows

Open OrcaWin opened this issue 4 months ago • 1 comments

Problem

In the Projects sidebar on Windows, hovering a project row reveals its controls (⌄ … +), but the row's + sits ~10px left of the Projects header's + — they're not flush. macOS lines them up fine.

Root cause: the list uses overflow-y: scroll with a reserved scrollbar-gutter: stable, so the scrollbar track is always present even when there's nothing to scroll. Two consequences on Windows:

  • The reserved gutter insets the rows (which live inside the scroll container) but not the fixed header — so the row + is pushed left of the header +.
  • With classic Windows scrollbars, the always-present track also paints the ▲/▼ arrow buttons in that gutter (the "up caret"), even with nothing to scroll.

macOS overlay scrollbars reserve no gutter and draw no buttons, so none of this shows there.

Fix

Switch the projects list to overflow-y: auto and drop the reserved scrollbar-gutter. When the list fits, there's no scrollbar, no gutter, and no arrow buttons — the row controls stay flush with the header controls, matching macOS. The scrollbar returns only while the list actually overflows.

  • WorktreeList.tsx: overflow-y-scroll → overflow-y-auto on the two sidebar scroll containers.
  • main.css: remove scrollbar-gutter: stable from .worktree-sidebar-scrollbar.

Verified (live, in a dev Orca instance on Windows via CDP)

Measured the header + and the hovered row + right-edges:

header + row + delta
Before x=272 x=262 10px
After x=272 x=272 0px
  • Fits: gutter 0 → no scrollbar, no caret, +s flush at the edge (matches macOS).
  • Overflows: scrollbar reappears and scrolls normally; virtual rows still render.

Notes / scope

  • macOS unchanged — it already reserved no gutter (overlay scrollbars), so this is a no-op there.
  • Trade-off: when the list does overflow, the scrollbar consumes width as it appears (content shifts by the scrollbar width) — standard behavior, and the same as macOS conceptually. The previous scrollbar-gutter: stable avoided that shift at the cost of the always-present gutter/arrows.
  • When the list overflows on older Windows/Chromium (classic scrollbars), the ▲/▼ buttons still appear on the real scrollbar. That's the expected "there is a scrollbar" case; happy to also switch the sidebar to a custom (webkit) button-free scrollbar on Windows if you want them gone there too.

OrcaWin avatar Jul 08 '26 22:07 OrcaWin

Review Change Stack

📝 Walkthrough

Walkthrough

This change updates the worktree sidebar scrollbar styling in main.css and switches both sidebar scroll containers in WorktreeList.tsx from overflow-y-scroll to overflow-y-auto. The sidebar scrollbar rule no longer reserves the gutter up front or sets non-webkit scrollbar colors, while keeping the right padding and webkit thumb styling.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the fix and verification, but it omits required Screenshots, Testing, AI Review Report, and Security Audit sections. Add the missing template sections: Screenshots, Testing, AI Review Report, and Security Audit, or explicitly mark them not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main UI change: showing the projects scrollbar only when the list overflows.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Jul 08 '26 23:07 coderabbitai[bot]