@devries-cameron20 / t3code-1 / commits / 69c217fb15
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): an IME Escape no longer sends the file picker or content search back to the palette (#30467)

spoukyii committed Nov 9, 2026 at 06:34 UTC 69c217fb15a79607bf2ab74a9d996c322db97100
2 files changed +50 -3
apps/web/src/shortcuts/commandPaletteCommands.browser.test.tsx
+49 -2
@@ -1,10 +1,14 @@
1 import { compileResolvedKeybindingsConfig } from "@t3tools/shared/keybindings";
2 import { describe, expect, it, vi } from "vite-plus/test";
3 -import { userEvent } from "vite-plus/test/browser";
3 +import { page, userEvent } from "vite-plus/test/browser";
4
5 import { render } from "../../test/render";
6 import { openCommandPalette } from "../commandPaletteBus";
7 -import { useCommandPaletteMount, useCommandPaletteStore } from "../commandPaletteStore";
7 +import {
8 + dispatchCommandPalette,
9 + useCommandPaletteMount,
10 + useCommandPaletteStore,
11 +} from "../commandPaletteStore";
12 import { installCommandPaletteCommands } from "./commandPaletteCommands";
13
14 const keybindings = compileResolvedKeybindingsConfig([
@@ -50,6 +54,49 @@ describe("command palette shortcuts", () => {
54 await screen.rerender(<div />);
55 expect(useCommandPaletteStore.getState().open).toBe(false);
56 });
57 +
58 + it("keep a child search open on a composing Escape", async () => {
59 + setup();
60 + await using screen = await render(
61 + <>
62 + <MountedPalette />
63 + <input aria-label="Search files" />
64 + </>,
65 + { router: "/" },
66 + );
67 + using commands = new DisposableStack();
68 + commands.defer(
69 + installCommandPaletteCommands(screen.router!, { keybindings: () => keybindings }),
70 + );
71 + dispatchCommandPalette({ _tag: "ToggleMode", mode: "files" });
72 + const input = page.getByRole("textbox", { name: "Search files" });
73 + await input.fill("にほん");
74 +
75 + for (const composition of [
76 + { key: "Escape", isComposing: true, keyCode: 27 },
77 + { key: "Escape", isComposing: false, keyCode: 229 },
78 + ]) {
79 + const event = new KeyboardEvent("keydown", {
80 + ...composition,
81 + bubbles: true,
82 + cancelable: true,
83 + });
84 + input.element().dispatchEvent(event);
85 + expect(event.defaultPrevented, JSON.stringify(composition)).toBe(false);
86 + expect(useCommandPaletteStore.getState()).toMatchObject({ open: true, mode: "files" });
87 + await expect.element(input).toHaveValue("にほん");
88 + await expect.element(input).toHaveFocus();
89 + }
90 +
91 + const escape = new KeyboardEvent("keydown", {
92 + key: "Escape",
93 + keyCode: 27,
94 + bubbles: true,
95 + cancelable: true,
96 + });
97 + input.element().dispatchEvent(escape);
98 + expect(escape.defaultPrevented).toBe(true);
99 + });
100 });
101
102 describe("openCommandPalette", () => {
apps/web/src/shortcuts/commandPaletteCommands.ts
+1 -1
@@ -50,7 +50,7 @@ export function installCommandPaletteCommands(
50 capture: true,
51 when: isCommandPaletteMounted,
52 onKeyDown: (event) => {
53 - if (event.isComposing || event.key !== "Escape") return false;
53 + if (event.isComposing || event.keyCode === 229 || event.key !== "Escape") return false;
54 const { open, mode } = useCommandPaletteStore.getState();
55 if (!open || mode === "command") return false;
56 consume(event);