Skip to content

Commit 3ca7e2a

Browse files
committed
fix(web): align the sidebar sheet toggle without overlap
1 parent 536c84f commit 3ca7e2a

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,9 @@ function SidebarControl() {
138138
// The right-side layout controls carry mr-px (border compensation inside
139139
// the panel), so the trigger mirrors it: both clusters sit one extra pixel
140140
// off their edge and the titlebar reads symmetric.
141+
// The sheet owns its trigger until its closing transition unmounts it.
141142
<div
142-
className="pointer-events-none fixed left-[var(--workspace-controls-left)] top-[var(--workspace-controls-top)] z-50 ml-px flex h-[var(--workspace-topbar-height)] items-center"
143+
className="pointer-events-none fixed left-[var(--workspace-controls-left)] top-[var(--workspace-controls-top)] z-50 ml-px flex h-[var(--workspace-topbar-height)] items-center in-[body:has([data-sidebar=sidebar][data-mobile=true])]:hidden"
143144
data-sidebar-control=""
144145
>
145146
<Tooltip>

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@ export const SidebarChromeHeader = memo(function SidebarChromeHeader({
5656
)}
5757
>
5858
{backdropVariant ? <SidebarStageBackdrop variant={backdropVariant} /> : null}
59-
<SidebarTrigger
60-
// Over the stage artwork: the media viewer's control-on-imagery treatment.
61-
variant={backdropVariant ? "media-navigation" : "ghost"}
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"
64-
/>
59+
{/* Match the fixed control's inset and border compensation inside the sheet's safe area. */}
60+
<div className="relative top-[calc(var(--workspace-controls-top)-env(safe-area-inset-top))] z-10 ml-[calc(var(--workspace-controls-left)+1px-env(safe-area-inset-left))] flex shrink-0 items-center md:hidden">
61+
<SidebarTrigger
62+
// Over the stage artwork: the media viewer's control-on-imagery treatment.
63+
variant={backdropVariant ? "media-navigation" : "ghost"}
64+
className="relative top-auto translate-y-0"
65+
aria-label="Toggle main sidebar"
66+
/>
67+
</div>
6568
{/* One visible line: the pill wraps onto the clipped second line once it no longer fits.
6669
The padding keeps the brand's focus ring inside the clip. */}
6770
<div className="relative z-10 flex h-8 min-w-0 flex-1 flex-wrap content-start items-center gap-x-2 overflow-hidden py-0.5">

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const SIDEBAR_WIDTH = "16rem";
2828
const SIDEBAR_WIDTH_MOBILE = "calc(100vw - var(--spacing(3)))";
2929
const SIDEBAR_WIDTH_ICON = "3rem";
3030
const SIDEBAR_RESIZE_DEFAULT_MIN_WIDTH = 16 * 16;
31+
const SIDEBAR_TITLEBAR_CONTROL_SIZE = "max-sm:[--workspace-titlebar-control-size:--spacing(8)]";
3132

3233
type SidebarContextProps = {
3334
state: ResponsiveSidebarState;
@@ -158,7 +159,8 @@ function SidebarProvider({
158159
<div
159160
// Inset layouts opt into bg-sidebar through className.
160161
className={cn(
161-
"group/sidebar-wrapper flex min-h-svh w-full max-sm:[--workspace-titlebar-control-size:--spacing(8)]",
162+
"group/sidebar-wrapper flex min-h-svh w-full",
163+
SIDEBAR_TITLEBAR_CONTROL_SIZE,
162164
className,
163165
)}
164166
data-sidebar-state={state}
@@ -258,6 +260,7 @@ function Sidebar({
258260
<div
259261
className={cn(
260262
"flex h-full w-full flex-col pb-safe pt-safe",
263+
SIDEBAR_TITLEBAR_CONTROL_SIZE,
261264
side === "left" ? "pl-safe" : "pr-safe",
262265
)}
263266
{...props}

0 commit comments

Comments
 (0)