The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): reserve the window-controls band on the narrow sidebar overlay (#110033)
Muhammed Emin Boydaka723194c1ec8
diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.test.tsx b/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.test.tsxindex 9f5e2baa8ce..cdb995343f1 100644--- a/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.test.tsx+++ b/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.test.tsx@@ -1,8 +1,9 @@import { act, cleanup, fireEvent, render } from '@testing-library/react'-import { afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest'+import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'import { PANE_TOGGLE_REVEAL_EVENT } from '@/components/pane-shell'import { registry } from '@/contrib/registry'+import { $connection } from '@/store/session'import { stubResizeObserver } from '@/test/jsdom'import { group, split } from '../model'@@ -50,6 +51,9 @@ afterEach(() => {cleanup()$narrowViewport.set(false)$layoutTree.set(null)+ $connection.set(null)+ vi.restoreAllMocks()+ delete (window as unknown as { hermesDesktop?: unknown }).hermesDesktopdisposers.splice(0).forEach(dispose => dispose())})@@ -91,4 +95,37 @@ describe('narrow overlay of a stacked zone', () => {expect(getByTestId('sessions-body')).toBeTruthy()expect(overlayTab('sessions')).toBeNull()})++ it('pads the overlay below the native window controls on macOS', () => {+ // Ground truth for "the SESSIONS tab strip slides under the traffic+ // lights on a narrow window" (#110033). The overlay starts at the+ // viewport's top edge, so without a reservation its tab strip sits under+ // the native controls.+ Object.defineProperty(window, 'hermesDesktop', { configurable: true, value: {} })+ $connection.set({ windowButtonPosition: { x: 24, y: 0 } } as never)+ // jsdom has no layout: the overlay fills the viewport's top-left corner.+ vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockReturnValue({+ bottom: 800,+ height: 800,+ left: 0,+ right: 237,+ toJSON: () => ({}),+ top: 0,+ width: 237,+ x: 0,+ y: 0+ } as DOMRect)++ render(<NarrowOverlays />)+ revealPane('sessions')++ // Controls rect = { x: 0, y: 0, width: 24 + 58, height: 34 }; the+ // reservation is the overlap's bottom edge, so the strip starts below it.+ const overlay = document.querySelector<HTMLElement>('[data-narrow-overlay="sessions"]')+ expect(overlay?.style.paddingTop).toBe('34px')+ // The reserved band stays a window-drag target, as in a docked TreeGroup.+ const dragSpacer = overlay?.querySelector<HTMLElement>('[aria-hidden="true"]')+ expect(dragSpacer).not.toBeNull()+ expect(dragSpacer?.style.height).toBe('34px')+ })})diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.tsx b/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.tsxindex a7513d5e65b..d2a190e2de1 100644--- a/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.tsx+++ b/apps/desktop/src/components/pane-shell/tree/renderer/narrow-overlays.tsx@@ -18,6 +18,7 @@ import { ESCAPE_PRIORITY, isTopEscapeLayer, pushEscapeLayer } from '@/lib/escapeimport { cn } from '@/lib/utils'import { PANE_TOGGLE_REVEAL_EVENT } from '../..'+import { useWindowControlsOverlap } from '../../geometry'import { NO_PANE_GROUP } from '../../pane-visibility'import { allPaneIds, findGroupOfPane } from '../model'import { $hiddenTreePanes, $layoutTree, $narrowViewport } from '../store'@@ -34,6 +35,14 @@ export function NarrowOverlays() {const hiddenPanes = useStore($hiddenTreePanes)const [reveal, setReveal] = useState<{ id: string; pinned: boolean } | null>(null)+ // The revealed overlay spans the full viewport height (inset-y-0 below), so+ // its tab strip starts at the top edge — under the native window controls+ // (macOS traffic lights) when the sidebar is on the left. Reserve their rect+ // the same way a docked zone does (TreeGroup's wcOverlap -> paddingTop plus+ // an absolute drag-region spacer so the band stays a window-drag target).+ const overlayRef = useRef<HTMLDivElement>(null)+ const wcOverlap = useWindowControlsOverlap(overlayRef, reveal !== null)+const onMouseLeave = useCallback<MouseEventHandler<HTMLDivElement>>(event => {// The overlay's chrome and its stable guest are DOM siblings, but one// hover boundary. Crossing between them must not dismiss an unpinned pane.@@ -173,12 +182,26 @@ export function NarrowOverlays() {// panes beneath it — a see-through overlay reads as text bleeding// through text. Contract: `[data-glass-opaque]` in styles.css.data-glass-opaque=""- data-narrow-overlay=""+ data-narrow-overlay={revealed.id}onMouseLeave={onMouseLeave}+ ref={overlayRef}// Match the pane's docked width (sessions ~237px, files its rail// width) instead of a fat fixed 20rem — capped for tiny screens.- style={{ width: `min(${(revealed.data as { width?: string } | undefined)?.width ?? '18rem'}, 85vw)` }}+ // paddingTop keeps the tab strip below the native window controls+ // (macOS traffic lights); the spacer above keeps that band+ // draggable, mirroring TreeGroup's reservation.+ style={{+ paddingTop: wcOverlap ? wcOverlap.y + wcOverlap.height : undefined,+ width: `min(${(revealed.data as { width?: string } | undefined)?.width ?? '18rem'}, 85vw)`+ }}>+ {wcOverlap && (+ <div+ aria-hidden="true"+ className="pointer-events-none absolute z-10 [-webkit-app-region:drag]"+ style={{ height: wcOverlap.height, left: wcOverlap.x, top: wcOverlap.y, width: wcOverlap.width }}+ />+ )}{/* Zone-mates share the overlay through the zone's own tab strip(SESSIONS | BOTS) — a lone pane keeps the stripless form. */}{zonePanes.length > 1 && (