The best way to control Claude Code, Codex and more from any computer or phone
fix(web): handle sidebar shortcut before editors (#3921)
Andrew Barnes committed
Jul 20, 2026 at 04:33 UTC
dfbda843628c817a48523b1a4a28a6ef232d1d65
2 files changed
+11
-2
apps/web/src/components/AppSidebarLayout.tsx
+9
-2
@@ -33,6 +33,12 @@ function SidebarControl() {
33
useEffect(() => {
34
const onKeyDown = (event: KeyboardEvent) => {
35
if (event.defaultPrevented) return;
36
+ if (
37
+ event.target instanceof HTMLElement &&
38
+ event.target.closest("[data-keybinding-capture]")
39
+ ) {
40
+ return;
41
+ }
42
if (resolveShortcutCommand(event, keybindings) !== "sidebar.toggle") return;
43
44
event.preventDefault();
@@ -40,8 +46,9 @@ function SidebarControl() {
46
toggleSidebar();
47
};
48
43
- window.addEventListener("keydown", onKeyDown);
44
- return () => window.removeEventListener("keydown", onKeyDown);
49
+ // Capture before focused editors consume commands such as Mod+B for rich-text formatting.
50
+ window.addEventListener("keydown", onKeyDown, true);
51
+ return () => window.removeEventListener("keydown", onKeyDown, true);
52
}, [keybindings, toggleSidebar]);
53
54
return (
apps/web/src/components/settings/KeybindingsSettings.tsx
+2
@@ -846,6 +846,7 @@ function KeybindingTableRow({
846
</button>
847
) : (
848
<Input
849
+ data-keybinding-capture=""
850
autoFocus={isRecording}
851
aria-label={`Keybinding for ${commandLabel(row.command)}`}
852
value={isRecording ? "" : keyDraft}
@@ -1011,6 +1012,7 @@ function NewKeybindingTableRow({
1012
</div>
1013
<div className="flex min-w-0 items-center gap-2 pr-4">
1014
<Input
1015
+ data-keybinding-capture=""
1016
aria-label={`Keybinding for ${commandLabelText}`}
1017
value={isRecording ? "" : keyDraft}
1018
placeholder={isRecording ? "Press shortcut" : "Unassigned"}