The best way to control Claude Code, Codex and more from any computer or phone
fix(web): narrow-window sidebar sheet obeys disabled panel animations (#35442)
Julius Marminge committed
Nov 12, 2026 at 10:07 UTC
7ab11f18719e2471c9f0cdcc797d1afa42beb285
2 files changed
+29
apps/web/src/components/ui/sidebar.browser.test.tsx
+21
@@ -1,6 +1,8 @@
1
import { page, userEvent } from "vite-plus/test/browser";
2
import { describe, expect, it, vi } from "vite-plus/test";
3
4
+import "~/index.css";
5
+
6
import { render } from "../../../test/render";
7
import { Sidebar, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar } from "./sidebar";
8
@@ -160,3 +162,22 @@ it("keeps closed mobile sheet contents mounted and reports the sheet only while
162
await expect.element(sheetMounted).toHaveTextContent("false");
163
expect(document.querySelector('[data-mobile="true"]')?.textContent).toContain("Sheet contents");
164
});
165
+
166
+it("opens the mobile sheet without a transition while panel animations are off", async () => {
167
+ await page.viewport(390, 844);
168
+ await using screen = await render(
169
+ <div data-panel-animations="false">
170
+ <SidebarProvider>
171
+ <Sidebar>
172
+ <span>Sheet contents</span>
173
+ </Sidebar>
174
+ <SidebarTrigger />
175
+ </SidebarProvider>
176
+ </div>,
177
+ { router: false /* no routes involved */ },
178
+ );
179
+ await userEvent.click(screen.getByRole("button", { name: "Toggle Sidebar" }));
180
+ const popup = document.querySelector<HTMLElement>('[data-mobile="true"][data-sidebar="sidebar"]');
181
+ expect(popup).not.toBeNull();
182
+ expect(getComputedStyle(popup!).transitionDuration).toBe("0s");
183
+});
apps/web/src/components/ui/sidebar.tsx
+8
@@ -17,6 +17,7 @@ import {
17
import { Tooltip, TooltipPopup, TooltipTrigger } from "~/components/ui/tooltip";
18
import { useResizeDrag } from "~/hooks/useResizeDrag";
19
import { useMediaQuery } from "~/hooks/useMediaQuery";
20
+import { useClientSettings } from "~/hooks/useSettings";
21
import {
22
getLocalStorageItem,
23
setLocalStorageItem,
@@ -292,6 +293,12 @@ function Sidebar({
293
resizable?: boolean | SidebarResizableOptions;
294
}) {
295
const { isMobile, state, openMobile, setOpenMobile, setMobileSheetMounted } = useSidebar();
296
+ // Not usePanelAnimationSettings: its navigation suppression would snap the sheet shut mid-exit when an item navigates.
297
+ const panelAnimationDurationMs = useClientSettings(
298
+ (settings) => settings.panelAnimationDurationMs,
299
+ );
300
+ const prefersReducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
301
+ const panelAnimationsActive = panelAnimationDurationMs > 0 && !prefersReducedMotion;
302
const offcanvasCollapsed = !isMobile && collapsible === "offcanvas" && state === "collapsed";
303
304
const resolvedResizable = resolveSidebarResizable({ collapsible, isMobile, resizable });
@@ -327,6 +334,7 @@ function Sidebar({
334
{/* Children stay mounted while closed so their window shortcuts, like thread jumps, keep working. */}
335
<SheetPopup
336
keepMounted
337
+ {...(panelAnimationsActive ? {} : { transitionDurationMs: 0 })}
338
className={cn(
339
"w-(--sidebar-width) max-w-none bg-sidebar surface-grain p-0 text-sidebar-foreground",
340
className,