@devries-cameron20 / t3code Mirror · read-only / commits / 232e930cd2
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 00:30 UTC

fix(web): implementation menu opens while preserving composer focus (#17111)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

NikaCholadze committed Oct 20, 2026 at 04:15 UTC 232e930cd29f847434bce68c10a0061c643c5aed
2 files changed +67 -1
apps/web/src/components/chat/ComposerPrimaryActions.browser.test.tsx new
+64
@@ -0,0 +1,64 @@
1 +import "~/index.css";
2 +
3 +import { act } from "react";
4 +import { createRoot } from "react-dom/client";
5 +import { expect, it, vi } from "vite-plus/test";
6 +import { page, userEvent } from "vite-plus/test/browser";
7 +
8 +vi.mock("~/hooks/useSettings", () => ({
9 + useEnvironmentIdentificationMode: () => "none",
10 +}));
11 +vi.mock("../SidebarStageBackdrop", () => ({
12 + StageBackdropButtonArt: () => null,
13 + useSidebarStageBackdropVariant: () => null,
14 +}));
15 +
16 +import { ComposerPrimaryActions } from "./ComposerPrimaryActions";
17 +
18 +it("opens implementation actions with a mouse while the composer is resting", async () => {
19 + vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
20 + const container = document.createElement("div");
21 + document.body.append(container);
22 + const root = createRoot(container);
23 + const onImplementPlanInNewThread = vi.fn();
24 +
25 + try {
26 + await act(async () => {
27 + root.render(
28 + <ComposerPrimaryActions
29 + compact={false}
30 + canOperateThread
31 + pendingAction={null}
32 + isRunning={false}
33 + canInterrupt={false}
34 + showPlanFollowUpPrompt
35 + promptHasText={false}
36 + isSendBusy={false}
37 + sendDisabledReason={null}
38 + isConnecting={false}
39 + isEnvironmentUnavailable={false}
40 + isPreparingWorktree={false}
41 + hasSendableContent={false}
42 + preserveComposerFocusOnPointerDown
43 + onPreviousPendingQuestion={() => {}}
44 + onInterrupt={() => {}}
45 + onImplementPlanInNewThread={onImplementPlanInNewThread}
46 + />,
47 + );
48 + });
49 +
50 + await act(async () => {
51 + await userEvent.click(page.getByRole("button", { name: "Implementation actions" }));
52 + });
53 + const item = page.getByRole("menuitem", { name: "Implement in a new thread" });
54 + await expect.element(item).toBeVisible();
55 + await act(async () => {
56 + await userEvent.click(item);
57 + });
58 + expect(onImplementPlanInNewThread).toHaveBeenCalledTimes(1);
59 + } finally {
60 + await act(async () => root.unmount());
61 + container.remove();
62 + vi.unstubAllGlobals();
63 + }
64 +});
apps/web/src/components/chat/ComposerPrimaryActions.tsx
+3 -1
@@ -239,7 +239,9 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
239 "h-9 rounded-l-none border-l border-message-action-foreground/20 px-2 sm:h-8",
240 )}
241 aria-label="Implementation actions"
242 - {...pointerFocusProps}
242 + onMouseDown={
243 + preserveComposerFocusOnPointerDown ? (event) => event.preventDefault() : undefined
244 + }
245 disabled={isSendBusy || isSendDisabled || isConnecting || isEnvironmentUnavailable}
246 />
247 }