From 1bfc4051c68182a6d766888e2d3905c3ef6be7ed Mon Sep 17 00:00:00 2001 From: Dotta Date: Tue, 9 Jun 2026 17:10:35 +0000 Subject: [PATCH] fix(ui): let closed sidebar suppress collapsed rail --- ui/src/components/SidebarShell.test.tsx | 17 +++++++++++++++++ ui/src/components/SidebarShell.tsx | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ui/src/components/SidebarShell.test.tsx b/ui/src/components/SidebarShell.test.tsx index edfb77b67fb..b423f15cf13 100644 --- a/ui/src/components/SidebarShell.test.tsx +++ b/ui/src/components/SidebarShell.test.tsx @@ -147,6 +147,23 @@ describe("SidebarShell", () => { expect(handle()).toBeNull(); }); + it("hides all sidebar width when closed, even if pinned collapsed", () => { + window.localStorage.setItem("test.sidebar.width", "320"); + + act(() => { + root.render( + +
Sidebar
+
, + ); + }); + + expect(spacer().style.width).toBe("0px"); + expect(panel().style.width).toBe("0px"); + expect(panel().getAttribute("data-sidebar-overlay")).toBeNull(); + expect(handle()).toBeNull(); + }); + it("overlays content while peeking without expanding the reserved spacer", () => { window.localStorage.setItem("test.sidebar.width", "300"); diff --git a/ui/src/components/SidebarShell.tsx b/ui/src/components/SidebarShell.tsx index 8625ced1c23..5d706761606 100644 --- a/ui/src/components/SidebarShell.tsx +++ b/ui/src/components/SidebarShell.tsx @@ -114,8 +114,8 @@ export function SidebarShell({ // Unified width function (plan ยง5): one code path for every pinned state. const expandedWidth = open ? width : 0; - const reservedWidth = collapsed ? SIDEBAR_RAIL_WIDTH : expandedWidth; - const panelWidth = collapsed && !peeking ? SIDEBAR_RAIL_WIDTH : expandedWidth; + const reservedWidth = !open ? 0 : collapsed ? SIDEBAR_RAIL_WIDTH : expandedWidth; + const panelWidth = !open ? 0 : collapsed && !peeking ? SIDEBAR_RAIL_WIDTH : expandedWidth; const isOverlay = panelWidth > reservedWidth; // The drag handle can only resize the expanded width, so it is disabled while