Skip to content

feat(ui): host the macOS dashboard titlebar buttons in the web UI#105902

Merged
steipete merged 7 commits into
mainfrom
claude/macos-web-ui-buttons-6dafc9
Jul 13, 2026
Merged

feat(ui): host the macOS dashboard titlebar buttons in the web UI#105902
steipete merged 7 commits into
mainfrom
claude/macos-web-ui-buttons-6dafc9

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #105898.

The Mac app dashboard hosted five native AppKit buttons (sidebar toggle, search, new session, back, forward) in a titlebar accessory floating over the Control UI WKWebView. Native and web chrome could never agree: hover/highlight styling didn't match the web buttons next to them, the accessory and its drag regions stacked over web overlays with no shared z-index, and the layout was mirrored across two codebases with magic offsets (nav-state width bridge, 78/116/128pt accessory constants, padding-left: 90/204px compensation CSS) that kept needing follow-up fixes (#104380, #104572, #104694, #105175).

Why This Change Was Made

Rendering the buttons in the web UI gives one owner for toolbar layout, highlight state, and stacking. The app keeps only what must stay native: traffic lights, thin top drag strips, and a small bridge.

  • Handshake: the app injects window.__OPENCLAW_NATIVE_WEB_CHROME__ = true at document start and stamps openclaw-native-macos openclaw-native-web-chrome on <html> (no more openclaw-native-nav).
  • New openclaw-macos-titlebar-controls web component renders sidebar toggle + back/forward (plus search + new session when the nav is collapsed) in the 50px titlebar strip at left: 78px, using the standard topbar-icon-btn treatment and an explicit z-index slot.
  • Back/forward call history.back()/forward() (same WKWebView session history); enable state flows from Swift KVO on canGoBack/canGoForward via openclaw:native-history-state events.
  • Deleted: DashboardNavAccessoryView, the openclawNav nav-state message handler, the native sidebar drag region (the web toolbar and the sidebar/topbar inset now start native drags via the existing window-drag bridge).
  • Compat: shipped app builds that stamp openclaw-native-nav keep working — the web retains that CSS path, the openclaw:native-* event handlers, and the nav-state post (a no-op against new apps). Older gateway bundles under a new app fall back to their own in-page toggles plus trackpad gestures and Cmd-[/] menu items.

User Impact

Mac app users get toolbar buttons that match the web UI's look, hover/highlight, tooltips, and focus rings, sit correctly under overlays, and stop drifting out of alignment with the sidebar. Narrow windows regain the drawer hamburger (the web toolbar hides below 1101px). No behavior change for browsers or other platforms.

Evidence

  • Focused UI unit tests pass (node scripts/run-vitest.mjs ui/src/app/native-web-chrome.test.ts ui/src/app/app-host.test.ts: 19 passed).
  • Extended ui/src/e2e/native-nav-sidebar-toggle.e2e.test.ts with web-chrome scenarios: toolbar renders, toggle/search/new-session work, back/forward follow history-state events, hamburger survives narrow widths; legacy openclaw-native-nav scenarios unchanged.
  • Swift smoke tests updated (DashboardWindowSmokeTests): capability script injected at document start, no titlebar accessories remain.
  • Native i18n inventory resynced (deleted button labels), changed=false after sync.
  • Hosted CI on this PR covers changed lanes + mac Swift tests; e2e lane run separately (not in PR CI).

@openclaw-barnacle openclaw-barnacle Bot added app: macos App: macos app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Jul 13, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof (landing over red CI on maintainer instruction — check-guards is failing fleet-wide because the #105894 LOC ratchet baseline is stale against pristine main itself, 15 violations reproduced on a674ce5; unrelated to this diff):

  • Blacksmith Testbox (final run at rebased head, lease tbx_01kxcqr3na6faxtfva2hqhbfe7): pnpm check:changed lanes green other than the fleet-broken LOC ratchet; earlier full run (lease tbx_01kxcp1zb4t0ym2jnkfe8m4z2k) green across format/typecheck-core/typecheck-UI/lint/guards pre-drift.
  • UI e2e on Testbox: ui/src/e2e/native-nav-sidebar-toggle.e2e.test.ts 6/6 pass, including the three new web-chrome scenarios (toolbar hosting, history-state enable/disable, narrow-width hamburger).
  • UI unit: node scripts/run-vitest.mjs ui/src/app/native-web-chrome.test.ts ui/src/app/app-host.test.ts — 19 pass; terminal-panel.test.ts 8/8 pass on Testbox (local failures are the known Node 26 jsdom issue).
  • macOS: swift build clean; swift test --filter DashboardWindowSmokeTests 27/27 pass locally.
  • i18n: control-ui sync fallbacks=0 across 20 locales; native inventory resynced.
  • Autoreview (Codex gpt-5.6-sol, xhigh): one P2 rejected as intentional — older gateway bundles/failure pages keep gestures, Cmd-[/] menu items, and their own in-page toggles instead of a native fallback; contract documented inline in DashboardWindowController.

Known gap: hosted CI check-guards/check-dependencies red from the main-side ratchet/baseline drift described above; owner approved landing over it.

@steipete
steipete merged commit b43e832 into main Jul 13, 2026
91 of 95 checks passed
@steipete
steipete deleted the claude/macos-web-ui-buttons-6dafc9 branch July 13, 2026 03:30
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 13, 2026
…enclaw#105902)

* feat(ui): host the macOS dashboard titlebar buttons in the web UI

* style(ui): oxfmt macos titlebar controls

* fix(ui): bracket-access native web chrome globals for no-underscore-dangle

* docs(macos): note intentional no-fallback contract for non-web-chrome pages

* chore(ui): drop unused NativeHistoryStateEvent export

* chore(i18n): resync native inventory line metadata

* chore(i18n): translate nav.back/nav.forward across locales
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos app: web-ui App: web-ui maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac app: native titlebar buttons fight the web UI (inconsistent highlight state, z-index, duplicated toolbar layout)

1 participant