From 7bd48b907d5f6f5ef6b5964857a39c8f753cdda6 Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Thu, 23 Apr 2026 21:38:16 -0400 Subject: [PATCH] fix(titlebar): make empty tab bar space draggable on macOS (#1013) --- src/renderer/src/App.tsx | 5 +- .../components/tab-group/TabGroupPanel.tsx | 59 ++++++++++++------- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index dfd21372a..53196c009 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -931,7 +931,10 @@ function App(): React.JSX.Element { open or closed. Its height matches the 42px workspace strip used by the sidebar and tab rows. */} {workspaceActive && !rightSidebarOpen && ( -
+
{rightSidebarToggle}
)} diff --git a/src/renderer/src/components/tab-group/TabGroupPanel.tsx b/src/renderer/src/components/tab-group/TabGroupPanel.tsx index e3c2dfa9f..d5dfdcb54 100644 --- a/src/renderer/src/components/tab-group/TabGroupPanel.tsx +++ b/src/renderer/src/components/tab-group/TabGroupPanel.tsx @@ -190,27 +190,32 @@ export default function TabGroupPanel({ can show multiple groups at once, while the window titlebar only has one shared center slot. Rendering true tab chrome here preserves per-group titles without making groups fight over one portal target. */} -
-
- {/* Why: when the right sidebar is closed, App.tsx renders a floating - explorer toggle in the top-right corner of the workspace. Only the - top-right tab group can sit underneath that button, so reserve - space in just that one header instead of pushing every group in. */} - {/* Why: collapsing the left worktree sidebar should let the terminal - reclaim the full left edge, but the top-left tab row should still - stop where the remaining titlebar controls end. Use the measured - width of that controls cluster instead of the old full sidebar - width so tabs cap at the agent badge, not at the old divider. */} + {/* Why: the macOS window uses hiddenInset titleBarStyle, so the only + way to drag-move the window is via -webkit-app-region: drag. Without + this, the empty space after tabs in the center column is dead — the + user can only drag from the tiny left-sidebar header strip. */} +
+
+ {/* Why: Electron's native drag hit-test only respects no-drag on DOM + descendants, not z-index siblings. When the left sidebar is + collapsed, its header floats absolutely (z-10) over this tab row + from a separate DOM branch. An explicit no-drag spacer here + punches a hole in the drag surface so the floating sidebar toggle + and other titlebar controls remain clickable. */} + {reserveCollapsedSidebarHeaderSpace && !sidebarOpen ? ( +
+ ) : null}
{tabBar}
{/* Why: pane-scoped layout actions belong with the active pane instead of the global tab-bar `+`, which should keep opening tabs exactly @@ -286,6 +291,18 @@ export default function TabGroupPanel({ ) : null}
+ {/* Why: Electron's native drag hit-test ignores z-index — a no-drag + element only overrides drag when it's a DOM descendant, not a + sibling in another branch. The floating right-sidebar toggle in + App.tsx sits in a separate DOM tree, so we need an explicit + no-drag child here to punch a hole in the drag surface beneath it + and let clicks through to the toggle. */} + {reserveClosedExplorerToggleSpace && !rightSidebarOpen ? ( +
+ ) : null}