Repository navigation
sidebar scrollbar always visible — should only appear when content overflows - #3283
lawrencecchen wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughUpdates Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 6/8 reviews remaining, refill in 9 minutes and 4 seconds.Comment |
Greptile SummaryThis PR fixes the always-visible sidebar scrollbar (#3241) by switching Confidence Score: 4/5Safe to merge with minor caveats — no data loss or crash risk; all findings are P2. All findings are P2: a potentially overly aggressive hasVerticalScroller = false for single workspaces (could block scrolling if a single row overflows), a redundant .scrollIndicators(.automatic) that competes with the direct NSScrollView mutation, and a small indentation regression. None of these affect correctness for current layouts. Sources/ContentView.swift — the workspaceScrollArea and workspaceRows functions around lines 9803–9900. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["SwiftUI render cycle\n(workspaceCount changes)"] --> B["ScrollView(.vertical)\n.scrollIndicators(.automatic)"]
B --> C["SidebarScrollViewResolver\nupdateNSView fires"]
C --> D["DispatchQueue.main.async\nresolveScrollView()"]
D --> E{"enclosingScrollView\nnil?"}
E -- "nil" --> F["dragAutoScrollController\n.attach(scrollView: nil)"]
E -- "found" --> G["Configure NSScrollView:\nhasHorizontalScroller = false\nscrollerStyle = .overlay\nautohidesScrollers = true"]
G --> H{"workspaceCount > 1?"}
H -- "yes" --> I["hasVerticalScroller = true\n(scroller shown on overflow)"]
H -- "no" --> J["hasVerticalScroller = false\n(scroller fully disabled)"]
I --> K["dragAutoScrollController\n.attach(scrollView: scrollView)"]
J --> K
Reviews (1): Last reviewed commit: "Address https://github.com/manaflow-ai/c..." | Re-trigger Greptile |
| let shouldShowScrollbar = renderContext.workspaceCount > 1 | ||
| scrollView.hasVerticalScroller = shouldShowScrollbar |
There was a problem hiding this comment.
hasVerticalScroller disabled entirely for single workspace
Setting hasVerticalScroller = false completely removes the scroller from the AppKit view hierarchy — it doesn't merely hide it. While autohidesScrollers = true + scrollerStyle = .overlay already handle the auto-hide behavior for the multi-workspace case, disabling the scroller by count means if a single workspace row ever grows tall enough to overflow the sidebar (e.g., deeply nested items, accessibility font sizes), users lose the ability to scroll entirely rather than just seeing a hidden/overlay scroller.
A more precise fix would be to keep hasVerticalScroller = true at all times and rely solely on autohidesScrollers = true with scrollerStyle = .overlay to suppress the visible indicator when content fits — the overlay style already auto-hides with no overflow.
| SidebarScrollViewResolver { scrollView in | ||
| dragAutoScrollController.attach(scrollView: scrollView) | ||
| } | ||
| .scrollIndicators(.automatic) |
There was a problem hiding this comment.
.scrollIndicators(.automatic) redundant given direct NSScrollView mutation
The SwiftUI .scrollIndicators(.automatic) modifier instructs the framework to manage scroll indicator visibility through its own layer. Immediately below, SidebarScrollViewResolver directly overrides the underlying NSScrollView properties (scrollerStyle, autohidesScrollers, hasVerticalScroller). These two mechanisms compete — SwiftUI may reset AppKit scroller state during subsequent layout passes, while the resolver re-applies on each updateNSView async dispatch. Since the NSScrollView configuration is the intentional behavior, .scrollIndicators(.automatic) is at best redundant and at worst adds fragile ordering dependence.
| } | ||
| } |
There was a problem hiding this comment.
Indentation regression on view modifiers
The .padding and .frame modifiers in workspaceRows picked up four extra leading spaces compared to the VStack they chain on. This is cosmetic but inconsistent with the surrounding style.
| } | |
| } | |
| .padding(.vertical, 8) | |
| .frame(maxWidth: .infinity, alignment: .leading) |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Closing this loader dogfood PR because the visual evidence showed the issue was still not fixed. The clean repro recording shows cmux with the sidebar scrollbar, and the prior fixed-after recording still shows the sidebar scrollbar in the single-workspace state. The follow-up agent run timed out before producing a valid fixed-after video. |
Addresses #3241
Generated by cmux-loader.
Recorded videos:
Run artifacts: https://github.com/manaflow-ai/cmux-loader/actions/runs/25091033007
Codex final message:
Implemented a narrow fix for #3241 in Sources/ContentView.swift.
What changed
VerticalTabsSidebarto:ScrollView(.vertical)),.scrollIndicators(.automatic)),NSScrollViewviaSidebarScrollViewResolverto:Verification performed
./scripts/reload.sh --tag loader-before(baseline build)./scripts/reload.sh --tag loader(fixed build)/Users/runner/Library/Developer/Xcode/DerivedData/cmux-loader-before/Build/Products/Debug/cmux DEV loader-before.app/Users/runner/Library/Developer/Xcode/DerivedData/cmux-loader/Build/Products/Debug/cmux DEV loader.app.cmux-loaderscripts (status=ok):repro-before→.runner/videos/repro-before-2.movfixed-after→.runner/videos/fixed-after-4.movI did not open or create a PR.
Summary by cubic
Fixes the always-visible scrollbar in the workspace sidebar so it only appears when content overflows. Addresses #3241.
ScrollViewwith automatic indicators inVerticalTabsSidebar.NSScrollViewviaSidebarScrollViewResolverto use overlay scrollers, auto-hide, and disable the horizontal scroller.Written for commit c2d28e7. Summary will update on new commits. Review in cubic
Summary by CodeRabbit