Skip to content

Commit 8c86f1d

Browse files
fix(web): respect input context for palette thread shortcuts
1 parent c119d79 commit 8c86f1d

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

‎apps/web/src/components/CommandPalette.tsx‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2870,19 +2870,24 @@ function OpenCommandPaletteDialog(props: {
28702870
function handleKeyDown(event: KeyboardEvent<HTMLInputElement>): void {
28712871
const command = resolveShortcutCommand(event, keybindings, {
28722872
platform: navigator.platform,
2873-
context: { modelPickerOpen: false },
2873+
context: { modelPickerOpen: false, editableFocus: true },
28742874
});
2875-
// A shortcut shown on a listed item runs that item. The global handlers
2876-
// ignore shortcuts while the palette is open, so nothing else would.
2875+
// Global new-thread handlers ignore shortcuts while the palette is open.
28772876
const isJump = threadJumpIndexFromCommand(command ?? "") !== null;
2878-
const matchingItem = command
2879-
? displayedGroups
2880-
.flatMap((group) => group.items)
2881-
.find((item) => item.shortcutCommand === command)
2882-
: undefined;
28832877
const isNewThread =
2884-
command === "chat.new" || command === "chat.newLocal" || command === "chat.newWithoutProject";
2885-
if (isJump || (matchingItem && isNewThread)) {
2878+
!event.nativeEvent.isComposing &&
2879+
event.keyCode !== 229 &&
2880+
(command === "chat.new" ||
2881+
command === "chat.newLocal" ||
2882+
command === "chat.newWithoutProject");
2883+
const matchingItem =
2884+
isJump || isNewThread
2885+
? displayedGroups
2886+
.flatMap((group) => group.items)
2887+
.find((item) => item.shortcutCommand === command)
2888+
: undefined;
2889+
if (isJump || matchingItem) {
2890+
(event as typeof event & { preventBaseUIHandler?: () => void }).preventBaseUIHandler?.();
28862891
event.preventDefault();
28872892
event.stopPropagation();
28882893
if (matchingItem) {

0 commit comments

Comments
 (0)