The best way to control Claude Code, Codex and more from any computer or phone
fix(web): project content search no longer opens a result on an IME Enter (#30448)
spoukyii committed
Nov 9, 2026 at 06:34 UTC
a4c2684a0feb1013af615da6a76fd3fd50f09334
2 files changed
+75
apps/web/src/components/search/ProjectContentSearchDialog.composition.browser.test.tsx
new
+74
@@ -0,0 +1,74 @@
1
+import { EnvironmentId, ThreadId } from "@t3tools/contracts";
2
+import { expect, it, vi } from "vite-plus/test";
3
+import { page, userEvent } from "vite-plus/test/browser";
4
+
5
+import { act, render } from "../../../test/render";
6
+import { useRightPanelStore } from "../../rightPanelStore";
7
+import { ProjectContentSearchDialog } from "./ProjectContentSearchDialog";
8
+
9
+const threadRef = {
10
+ environmentId: EnvironmentId.make("local"),
11
+ threadId: ThreadId.make("thread"),
12
+};
13
+
14
+const { search } = vi.hoisted(() => ({
15
+ search: {
16
+ canReadFiles: true,
17
+ isCheckingAccess: false,
18
+ hasQuery: true,
19
+ isPending: false,
20
+ error: null,
21
+ invalidRegex: false,
22
+ truncated: false,
23
+ matches: [
24
+ { path: "a.ts", lineNumber: 1, lineContent: "計画", matchRanges: [] },
25
+ { path: "b.ts", lineNumber: 2, lineContent: "計画", matchRanges: [] },
26
+ { path: "c.ts", lineNumber: 3, lineContent: "計画", matchRanges: [] },
27
+ ],
28
+ },
29
+}));
30
+
31
+vi.mock("~/hooks/useActiveProjectTarget", () => ({
32
+ useActiveProjectTarget: () => ({
33
+ environmentId: threadRef.environmentId,
34
+ cwd: "/workspace",
35
+ projectName: "workspace",
36
+ threadRef,
37
+ }),
38
+}));
39
+vi.mock("~/hooks/useTheme", () => ({
40
+ useRenderedAppearance: () => "light",
41
+ useTheme: () => ({ theme: "t3-chat", resolvedTheme: "light", appearanceMode: "light" }),
42
+}));
43
+vi.mock("~/state/session", async (original) => ({
44
+ ...(await original<typeof import("~/state/session")>()),
45
+ readEnvironmentScope: () => true,
46
+}));
47
+vi.mock("~/state/queries", async (original) => ({
48
+ ...(await original<typeof import("~/state/queries")>()),
49
+ useProjectContentSearch: () => search,
50
+}));
51
+
52
+it("ignores composing keys in the search", async () => {
53
+ using openFile = vi.spyOn(useRightPanelStore.getState(), "openFile").mockImplementation(() => {});
54
+ const onOpenChange = vi.fn();
55
+ await using _screen = await render(<ProjectContentSearchDialog onOpenChange={onOpenChange} />);
56
+ const input = page.getByRole("combobox");
57
+ await input.fill("計画");
58
+
59
+ for (const composition of [
60
+ { key: "ArrowDown", isComposing: true, keyCode: 40 },
61
+ { key: "ArrowDown", isComposing: false, keyCode: 229 },
62
+ { key: "Enter", isComposing: true, keyCode: 13 },
63
+ { key: "Enter", isComposing: false, keyCode: 229 },
64
+ ]) {
65
+ const event = new KeyboardEvent("keydown", { ...composition, bubbles: true, cancelable: true });
66
+ await act(() => input.element().dispatchEvent(event));
67
+ }
68
+ expect(onOpenChange).not.toHaveBeenCalled();
69
+ expect(openFile).not.toHaveBeenCalled();
70
+
71
+ await userEvent.keyboard("{Enter}");
72
+ expect(onOpenChange).toHaveBeenCalledExactlyOnceWith(false);
73
+ expect(openFile).toHaveBeenCalledExactlyOnceWith(threadRef, "a.ts", 1);
74
+});
apps/web/src/components/search/ProjectContentSearchDialog.tsx
+1
@@ -199,6 +199,7 @@ function OpenContentSearchDialog(props: {
199
disabled: !search.canReadFiles,
200
placeholder: `Search in ${target.projectName}`,
201
onKeyDown: (event) => {
202
+ if (event.nativeEvent.isComposing || event.keyCode === 229) return;
203
if (event.key === "ArrowDown" && matches.length > 0) {
204
event.preventDefault();
205
setSelectedIndex((current) => (current + 1) % matches.length);