Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(web): handle sidebar shortcut before editors (#3921)

Andrew Barnesdfbda843628c
diff --git a/apps/web/src/components/AppSidebarLayout.tsx b/apps/web/src/components/AppSidebarLayout.tsx
index 587ec65cb..4d0486aa8 100644
--- a/apps/web/src/components/AppSidebarLayout.tsx
+++ b/apps/web/src/components/AppSidebarLayout.tsx
@@ -33,6 +33,12 @@ function SidebarControl() {
useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => {
if (event.defaultPrevented) return;
+ if (
+ event.target instanceof HTMLElement &&
+ event.target.closest("[data-keybinding-capture]")
+ ) {
+ return;
+ }
if (resolveShortcutCommand(event, keybindings) !== "sidebar.toggle") return;
event.preventDefault();
@@ -40,8 +46,9 @@ function SidebarControl() {
toggleSidebar();
};
- window.addEventListener("keydown", onKeyDown);
- return () => window.removeEventListener("keydown", onKeyDown);
+ // Capture before focused editors consume commands such as Mod+B for rich-text formatting.
+ window.addEventListener("keydown", onKeyDown, true);
+ return () => window.removeEventListener("keydown", onKeyDown, true);
}, [keybindings, toggleSidebar]);
return (
diff --git a/apps/web/src/components/settings/KeybindingsSettings.tsx b/apps/web/src/components/settings/KeybindingsSettings.tsx
index b7dbbd357..67c33c9b9 100644
--- a/apps/web/src/components/settings/KeybindingsSettings.tsx
+++ b/apps/web/src/components/settings/KeybindingsSettings.tsx
@@ -846,6 +846,7 @@ function KeybindingTableRow({
</button>
) : (
<Input
+ data-keybinding-capture=""
autoFocus={isRecording}
aria-label={`Keybinding for ${commandLabel(row.command)}`}
value={isRecording ? "" : keyDraft}
@@ -1011,6 +1012,7 @@ function NewKeybindingTableRow({
</div>
<div className="flex min-w-0 items-center gap-2 pr-4">
<Input
+ data-keybinding-capture=""
aria-label={`Keybinding for ${commandLabelText}`}
value={isRecording ? "" : keyDraft}
placeholder={isRecording ? "Press shortcut" : "Unassigned"}