Skip to content

Commit b4f5396

Browse files
fix(web): sidebar toggle no longer sits under the macOS window buttons
On macOS desktop a window narrower than 768 CSS px shows the sidebar as a sheet. The sheet is portaled outside the sidebar provider, so its header never saw the window-button inset and put its own toggle at the plain left padding, under the red and yellow buttons. Pass the inset to the sidebar itself and position the sheet's toggle by it. Web, Windows, Linux and macOS fullscreen resolve the same variable to the old 12px. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 1f6df6b commit b4f5396

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎apps/web/src/components/AppSidebarLayout.tsx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,15 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
259259
? getWindowFullscreenState()
260260
: false;
261261
});
262+
const windowControlsInsetStyle = (
263+
isMacosDesktop && !isWindowFullscreen
264+
? { "--workspace-controls-left": MACOS_TRAFFIC_LIGHTS_LEFT_INSET }
265+
: {}
266+
) as CSSProperties;
262267
const sidebarProviderStyle = {
263268
"--sidebar-width": `${clampThreadSidebarWidth(sidebarWidth, sidebarMinimumWidth, sidebarMaximumWidth)}px`,
264269
"--panel-animation-duration": `${panelAnimationDurationMs}ms`,
265-
...(isMacosDesktop && !isWindowFullscreen
266-
? { "--workspace-controls-left": MACOS_TRAFFIC_LIGHTS_LEFT_INSET }
267-
: {}),
270+
...windowControlsInsetStyle,
268271
} as CSSProperties;
269272

270273
useEffect(() => {
@@ -329,6 +332,8 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
329332
storageKey: THREAD_SIDEBAR_WIDTH_STORAGE_KEY,
330333
onResize: setSidebarWidth,
331334
}}
335+
// The narrow-window sidebar is a sheet, portaled outside the provider's styles.
336+
style={windowControlsInsetStyle}
332337
>
333338
{isOnSettings ? (
334339
<>

‎apps/web/src/components/sidebar/SidebarChrome.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,16 @@ export const SidebarChromeHeader = memo(function SidebarChromeHeader({
5151
// The titlebar row, not a padded SidebarHeader: it aligns to the window controls.
5252
<div
5353
className={cn(
54-
"relative flex h-[var(--workspace-topbar-height)] shrink-0 flex-row items-center gap-2 px-3 md:pl-0",
54+
"relative flex h-[var(--workspace-topbar-height)] shrink-0 flex-row items-center gap-2 pr-3",
5555
isElectron && "drag-region",
5656
)}
5757
>
5858
{backdropVariant ? <SidebarStageBackdrop variant={backdropVariant} /> : null}
5959
<SidebarTrigger
6060
// Over the stage artwork: the media viewer's control-on-imagery treatment.
6161
variant={backdropVariant ? "media-navigation" : "ghost"}
62-
className="relative top-auto z-10 translate-y-0 md:hidden"
62+
// The sheet's own trigger, at the window controls inset. The sheet already pads the safe area.
63+
className="relative top-auto z-10 ml-[calc(var(--workspace-controls-left)-env(safe-area-inset-left))] translate-y-0 md:hidden"
6364
/>
6465
{/* One visible line: the pill wraps onto the clipped second line once it no longer fits.
6566
The padding keeps the brand's focus ring inside the clip. */}

0 commit comments

Comments
 (0)