Skip to content

fix: lock the toolbar to icon-only so the sidebar toggle can't fold into the overflow menu#85

Merged
thdxg merged 1 commit into
mainfrom
claude/clever-diffie-fb6e22
Jun 12, 2026
Merged

fix: lock the toolbar to icon-only so the sidebar toggle can't fold into the overflow menu#85
thdxg merged 1 commit into
mainfrom
claude/clever-diffie-fb6e22

Conversation

@thdxg

@thdxg thdxg commented Jun 12, 2026

Copy link
Copy Markdown
Owner

What

Right-clicking the toolbar offered Icon and Text / Icon Only / Text Only display modes. Picking Icon and Text broke the toolbar: the sidebar toggle disappeared from its top-left spot and folded into the overflow (») menu at the trailing edge, and the titlebar grew taller without showing any useful labels.

This locks the toolbar to icon-only rendering and removes those context-menu options via NSToolbar.allowsDisplayModeCustomization = false.

Why

The breakage is a framework-level issue, not something we can style around: NavigationSplitView owns the sidebar-toggle toolbar item, and SwiftUI's toolbar items misreport their size in the label display modes, so AppKit folds the toggle into overflow even with plenty of room. Reproduced and confirmed by opening the overflow menu — “Hide Sidebar” was inside it.

allowsDisplayModeCustomization is the macOS 15+ API Apple added for exactly this case (apps whose unified toolbars don't support text labels opt out — Notes, Reminders, etc. don't offer the menu at all). Forcing displayMode = .iconOnly additionally repairs the state for anyone who already switched modes before the lock existed.

How

A new syncToolbar(window:) in WindowAppearance, called from WindowAppearance.sync — which already re-applies window chrome idempotently on launch, become-main, fullscreen transitions, and config changes, so the lock applies once the toolbar exists and stays applied if AppKit rebuilds it.

Verified

  • Reproduced the bug pre-fix via the toolbar context menu (toggle folded into », taller titlebar).
  • Post-fix: toolbar renders icon-only, right-clicking the toolbar shows no display-mode menu, and the sidebar toggle still collapses/expands the sidebar from its normal spot.
  • mise run format, lint, and test all pass.

🤖 Generated with Claude Code

…nto the overflow menu

The toolbar's right-click menu offered Icon and Text / Text Only modes,
but SwiftUI's NavigationSplitView toolbar doesn't survive them: AppKit
folds the system sidebar-toggle item into the overflow (>>) menu at the
trailing edge and grows the titlebar without showing any useful labels.
The folding happens inside SwiftUI's private toolbar items, so there is
no supported way to make the label modes render correctly.

Opt out via NSToolbar.allowsDisplayModeCustomization (the macOS 15 API
added for exactly this case) and force displayMode back to .iconOnly to
repair a mode picked before the lock existed. Applied from
WindowAppearance.sync, which already re-applies window chrome
idempotently on launch, become-main, and fullscreen transitions.
@github-actions github-actions Bot added the area:ui Views, Settings UI label Jun 12, 2026
@thdxg thdxg merged commit 51479f8 into main Jun 12, 2026
5 checks passed
@thdxg thdxg deleted the claude/clever-diffie-fb6e22 branch June 12, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ui Views, Settings UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant