@devries-cameron20 / t3code-1 / commits / c8625cafce
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): Ctrl+B reaches a focused terminal again (#34588)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Timo S. committed Nov 19, 2026 at 20:24 UTC c8625cafce8dd0195f024efbbed66f7d803a1bf5
4 files changed +52 -9
apps/web/src/components/AppSidebarLayout.tsx
+12 -9
@@ -21,6 +21,7 @@ import {
21 import { getLocalStorageItem, removeLocalStorageItem } from "../hooks/useLocalStorage";
22 import {
23 isRichTextBoldShortcut,
24 + isSidebarToggleShortcut,
25 resolveShortcutCommand,
26 shortcutLabelForCommand,
27 } from "../keybindings";
@@ -348,15 +349,17 @@ function SidebarControl({ showSidebar }: { readonly showSidebar: boolean }) {
349 // the toggle stays available everywhere else.
350 return;
351 }
351 - const command = resolveShortcutCommand(event, keybindings, {
352 - context: {
353 - terminalFocus: isTerminalFocused(),
354 - previewFocus: isPreviewFocused(),
355 - ...readRoutePanelsOpen(router),
356 - usagePageOpen,
357 - },
358 - });
359 - if (command !== "sidebar.toggle") return;
352 + if (
353 + !isSidebarToggleShortcut(event, keybindings, {
354 + context: {
355 + terminalFocus: isTerminalFocused(),
356 + previewFocus: isPreviewFocused(),
357 + ...readRoutePanelsOpen(router),
358 + usagePageOpen,
359 + },
360 + })
361 + )
362 + return;
363
364 event.preventDefault();
365 event.stopPropagation();
apps/web/src/keybindings.test.ts
+28
@@ -15,6 +15,7 @@ import {
15 effectiveShortcutsForCommand,
16 formatShortcutLabel,
17 isRichTextBoldShortcut,
18 + isSidebarToggleShortcut,
19 isTerminalNewShortcut,
20 isTerminalSplitShortcut,
21 resolveChatShortcutCommand,
@@ -813,6 +814,33 @@ describe("isRichTextBoldShortcut", () => {
814 });
815 });
816
817 +describe("isSidebarToggleShortcut", () => {
818 + it("leaves Ctrl+B to a focused terminal, where it is the tmux prefix", () => {
819 + const ctrlB = event({ key: "b", ctrlKey: true });
820 + assert.isFalse(
821 + isSidebarToggleShortcut(ctrlB, DEFAULT_BINDINGS, {
822 + platform: "Linux",
823 + context: { terminalFocus: true },
824 + }),
825 + );
826 + assert.isTrue(
827 + isSidebarToggleShortcut(ctrlB, DEFAULT_BINDINGS, {
828 + platform: "Linux",
829 + context: { terminalFocus: false },
830 + }),
831 + );
832 + });
833 +
834 + it("keeps Cmd+B toggling the sidebar from a focused terminal on macOS", () => {
835 + assert.isTrue(
836 + isSidebarToggleShortcut(event({ key: "b", metaKey: true }), DEFAULT_BINDINGS, {
837 + platform: "MacIntel",
838 + context: { terminalFocus: true },
839 + }),
840 + );
841 + });
842 +});
843 +
844 describe("composer and pull request shortcuts", () => {
845 it("uses the dictation chord outside the terminal and preserves terminal split", () => {
846 const chord = event({ key: "d", ctrlKey: true, shiftKey: true });
apps/web/src/keybindings.ts
+10
@@ -379,6 +379,16 @@ export function isDiffToggleShortcut(
379 return matchesCommandShortcut(event, keybindings, "diff.toggle", options);
380 }
381
382 +export function isSidebarToggleShortcut(
383 + event: ShortcutEventLike,
384 + keybindings: ResolvedKeybindingsConfig,
385 + options?: ShortcutMatchOptions,
386 +): boolean {
387 + // A focused terminal owns Ctrl chords, such as tmux's Ctrl+B prefix; Cmd never reaches it.
388 + if (event.ctrlKey && options?.context?.terminalFocus) return false;
389 + return matchesCommandShortcut(event, keybindings, "sidebar.toggle", options);
390 +}
391 +
392 export function isOpenFavoriteEditorShortcut(
393 event: ShortcutEventLike,
394 keybindings: ResolvedKeybindingsConfig,
docs/user/keybindings.md
+2
@@ -209,6 +209,8 @@ if the browser takes it first.
209
210 Many defaults include `!terminalFocus` so they do not intercept terminal input.
211 Keep that condition when remapping them if you want the same behavior.
212 +`sidebar.toggle` never takes a Ctrl chord from a focused terminal, so tmux's `Ctrl+B`
213 +prefix reaches it. On macOS, `Cmd+B` still toggles the sidebar there.
214
215 ## Desktop quit shortcut
216