The best way to control Claude Code, Codex and more from any computer or phone
fix(web): the publish-repository path no longer submits on an IME composition Enter (#28277)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Victor committed
Nov 14, 2026 at 05:56 UTC
e096deebf6ffd5f7ab72a5c4d01128cf7ae067f5
2 files changed
+90
-4
apps/web/src/components/GitActionsControl.composition.browser.test.tsx
new
+82
@@ -0,0 +1,82 @@
1
+import { SourceControlProviderKind } from "@t3tools/contracts";
2
+import * as Option from "effect/Option";
3
+import { expect, it, vi } from "vite-plus/test";
4
+import { page, userEvent } from "vite-plus/test/browser";
5
+
6
+import { act, render } from "../../test/render";
7
+import { PublishRepositoryDialog } from "./GitActionsControl";
8
+
9
+const publish = vi.hoisted(() => ({ run: vi.fn() }));
10
+
11
+vi.mock("~/state/query", () => ({
12
+ useEnvironmentQuery: () => ({
13
+ data: {
14
+ versionControlSystems: [],
15
+ sourceControlProviders: [
16
+ {
17
+ kind: SourceControlProviderKind.make("github"),
18
+ label: "GitHub",
19
+ status: "available",
20
+ version: Option.none(),
21
+ installHint: "Install gh",
22
+ detail: Option.none(),
23
+ auth: {
24
+ status: "authenticated",
25
+ account: Option.none(),
26
+ host: Option.none(),
27
+ detail: Option.none(),
28
+ },
29
+ },
30
+ ],
31
+ },
32
+ }),
33
+}));
34
+
35
+vi.mock("~/state/sourceControlActions", () => ({
36
+ useGitStackedAction: vi.fn(),
37
+ useSourceControlActionRunning: vi.fn(),
38
+ useVcsInitAction: vi.fn(),
39
+ useVcsPullAction: vi.fn(),
40
+ useSourceControlPublishRepositoryAction: () => ({
41
+ isAllowed: true,
42
+ isPending: false,
43
+ run: publish.run,
44
+ }),
45
+}));
46
+
47
+function setup() {
48
+ publish.run.mockReset();
49
+ publish.run.mockReturnValue(new Promise(() => {}));
50
+}
51
+
52
+it("keeps composition Enter in the repository path from publishing", async () => {
53
+ setup();
54
+ await using _screen = await render(
55
+ <PublishRepositoryDialog
56
+ open
57
+ onOpenChange={() => {}}
58
+ environmentId={null}
59
+ threadRef={null}
60
+ gitCwd="/repo"
61
+ offeredProviders={undefined}
62
+ />,
63
+ );
64
+ await page.getByRole("button", { name: "Next" }).click();
65
+ const path = page.getByRole("textbox", { name: "Repository" });
66
+ await path.fill("octo/repo");
67
+
68
+ for (const nativeEvent of [{ isComposing: true }, { keyCode: 229 }]) {
69
+ const event = new KeyboardEvent("keydown", {
70
+ key: "Enter",
71
+ ...nativeEvent,
72
+ bubbles: true,
73
+ cancelable: true,
74
+ });
75
+ await act(() => path.element().dispatchEvent(event));
76
+ expect(publish.run).not.toHaveBeenCalled();
77
+ expect(event.defaultPrevented).toBe(false);
78
+ }
79
+
80
+ await userEvent.keyboard("{Enter}");
81
+ expect(publish.run).toHaveBeenCalledOnce();
82
+});
apps/web/src/components/GitActionsControl.tsx
+8
-4
@@ -466,7 +466,7 @@ interface PublishRepositoryDialogProps {
466
readonly offeredProviders: OfferedSourceControlProviders | undefined;
467
}
468
469
-function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
469
+export function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
470
const openLink = useOpenLink(props.threadRef);
471
const navigate = useNavigate();
472
const sourceControlDiscovery = useEnvironmentQuery(
@@ -738,10 +738,14 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
738
setPublishRepositoryOverride(event.target.value);
739
}}
740
onKeyDown={(event) => {
741
- if (event.key === "Enter") {
742
- event.preventDefault();
743
- submitPublishRepository();
741
+ if (event.key !== "Enter") {
742
+ return;
743
}
744
+ if (event.nativeEvent.isComposing || event.keyCode === 229) {
745
+ return;
746
+ }
747
+ event.preventDefault();
748
+ submitPublishRepository();
749
}}
750
placeholder={publishPathPlaceholder}
751
disabled={publishRepositoryAction.isPending}