Skip to content

Commit 533b363

Browse files
🤖 fix: make Ctrl+Shift+E and Ctrl+T keybinds work regardless of focus (#1087)
Move OPEN_IN_EDITOR and OPEN_TERMINAL handlers before the `isEditableElement` guard so they work even when focus is on the chat input or other text fields. This matches the behavior of TOGGLE_MODE (Ctrl+Shift+M) which already works globally. _Generated with `mux`_
1 parent 5f47458 commit 533b363

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

‎src/browser/hooks/useAIViewKeybinds.ts‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ export function useAIViewKeybinds({
136136
return;
137137
}
138138

139+
// Open in editor / terminal - work even in input fields (global feel, like TOGGLE_MODE)
140+
if (matchesKeybind(e, KEYBINDS.OPEN_IN_EDITOR)) {
141+
e.preventDefault();
142+
handleOpenInEditor();
143+
return;
144+
}
145+
if (matchesKeybind(e, KEYBINDS.OPEN_TERMINAL)) {
146+
e.preventDefault();
147+
handleOpenTerminal();
148+
return;
149+
}
150+
139151
// Don't handle other shortcuts if user is typing in an input field
140152
if (isEditableElement(e.target)) {
141153
return;
@@ -144,12 +156,6 @@ export function useAIViewKeybinds({
144156
if (matchesKeybind(e, KEYBINDS.JUMP_TO_BOTTOM)) {
145157
e.preventDefault();
146158
jumpToBottom();
147-
} else if (matchesKeybind(e, KEYBINDS.OPEN_TERMINAL)) {
148-
e.preventDefault();
149-
handleOpenTerminal();
150-
} else if (matchesKeybind(e, KEYBINDS.OPEN_IN_EDITOR)) {
151-
e.preventDefault();
152-
handleOpenInEditor();
153159
}
154160
};
155161

0 commit comments

Comments
 (0)