From f576efdc23d7060742e58bb08edc9f18961ce07d Mon Sep 17 00:00:00 2001 From: Alex Southwell <4596216+saphid@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:27:47 +1100 Subject: [PATCH] fix(web): the sidebar shortcut honors terminal and preview focus conditions Co-Authored-By: Claude Opus 5.5 --- .../AppSidebarLayout.browser.test.tsx | 42 +++++++++++++++++++ apps/web/src/components/AppSidebarLayout.tsx | 16 ++++--- 2 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 apps/web/src/components/AppSidebarLayout.browser.test.tsx diff --git a/apps/web/src/components/AppSidebarLayout.browser.test.tsx b/apps/web/src/components/AppSidebarLayout.browser.test.tsx new file mode 100644 index 0000000000000..c97ea5e6412aa --- /dev/null +++ b/apps/web/src/components/AppSidebarLayout.browser.test.tsx @@ -0,0 +1,42 @@ +import { page, userEvent } from "vite-plus/test/browser"; +import { describe, expect, it, vi } from "vite-plus/test"; + +import { render } from "../../test/render"; + +vi.mock(import("../state/server"), async (original) => { + const actual = await original(); + const { Atom } = await import("effect/reactivity"); + const { compileResolvedKeybindingsConfig } = await import("@t3tools/shared/keybindings"); + const keybindings = compileResolvedKeybindingsConfig([ + { key: "mod+b", command: "sidebar.toggle", when: "!terminalFocus" }, + ]); + return { ...actual, primaryServerKeybindingsAtom: Atom.make(keybindings) }; +}); +// The thread list needs live environments; the shortcut lives in the shell around it. +vi.mock(import("./Sidebar"), () => ({ default: (() => null) as never })); + +import { AppSidebarLayout } from "./AppSidebarLayout"; + +describe("sidebar toggle shortcut", () => { + it("leaves the key to a focused terminal when its rule excludes terminalFocus", async () => { + await page.viewport(1280, 800); + using _platform = vi.spyOn(navigator, "platform", "get").mockReturnValue("Linux x86_64"); + await using screen = await render( + +
+