The best way to control Claude Code, Codex and more from any computer or phone
fix(web): use capture-phase keydown listener so CTRL+J toggles terminal from terminal focus on Windows (#2113) (#2142)
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Matt Van Horn committed
Apr 17, 2026 at 19:07 UTC
0f184c28b056b977593fa7f850217063d3043642
2 files changed
+11
-2
apps/web/src/components/ChatView.tsx
+2
-2
@@ -2290,8 +2290,8 @@ export default function ChatView(props: ChatViewProps) {
2290
event.stopPropagation();
2291
void runProjectScript(script);
2292
};
2293
- window.addEventListener("keydown", handler);
2294
- return () => window.removeEventListener("keydown", handler);
2293
+ window.addEventListener("keydown", handler, true);
2294
+ return () => window.removeEventListener("keydown", handler, true);
2295
}, [
2296
activeProject,
2297
terminalState.terminalOpen,
apps/web/src/keybindings.test.ts
+9
@@ -131,6 +131,15 @@ describe("isTerminalToggleShortcut", () => {
131
isTerminalToggleShortcut(event({ ctrlKey: true }), DEFAULT_BINDINGS, { platform: "Win32" }),
132
);
133
});
134
+
135
+ it("matches Ctrl+J on non-macOS while terminalFocus is true", () => {
136
+ assert.isTrue(
137
+ isTerminalToggleShortcut(event({ ctrlKey: true }), DEFAULT_BINDINGS, {
138
+ platform: "Win32",
139
+ context: { terminalFocus: true },
140
+ }),
141
+ );
142
+ });
143
});
144
145
describe("split/new/close terminal shortcuts", () => {