authorgravatar for mvanhorn@users.noreply.github.comMatt Van Horn <mvanhorn@users.noreply.github.com> 2026-04-17 19:07:04-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-04-17 23:07:04+00:00
log0f184c28b056b977593fa7f850217063d3043642
treed301bdc97343a5997ea3b76c8b27b0410e084b39
parenta3b1df5224700a1d76e590e4d7b29fd5a7a8e4d6
signature Signed by PGP key B5690EEEBB952194

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>

2 files changed, 11 insertions(+), 2 deletions(-)

apps/web/src/components/ChatView.tsx+2-2
...@@ -2290,8 +2290,8 @@ export default function ChatView(props: ChatViewProps) {...@@ -2290,8 +2290,8 @@ export default function ChatView(props: ChatViewProps) {
2290 event.stopPropagation();2290 event.stopPropagation();
2291 void runProjectScript(script);2291 void runProjectScript(script);
2292 };2292 };
2293 window.addEventListener("keydown", handler);2293 window.addEventListener("keydown", handler, true);
2294 return () => window.removeEventListener("keydown", handler);2294 return () => window.removeEventListener("keydown", handler, true);
2295 }, [2295 }, [
2296 activeProject,2296 activeProject,
2297 terminalState.terminalOpen,2297 terminalState.terminalOpen,
apps/web/src/keybindings.test.ts+9
...@@ -131,6 +131,15 @@ describe("isTerminalToggleShortcut", () => {...@@ -131,6 +131,15 @@ describe("isTerminalToggleShortcut", () => {
131 isTerminalToggleShortcut(event({ ctrlKey: true }), DEFAULT_BINDINGS, { platform: "Win32" }),131 isTerminalToggleShortcut(event({ ctrlKey: true }), DEFAULT_BINDINGS, { platform: "Win32" }),
132 );132 );
133 });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 });
134});143});
135144
136describe("split/new/close terminal shortcuts", () => {145describe("split/new/close terminal shortcuts", () => {