@devries-cameron20 / t3code-1 / commits / a678948483
Fork 0

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

fix(web): pending-question digit shortcuts ignore dialogs, menus and selects (#28388)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Victor committed Nov 14, 2026 at 06:45 UTC a678948483864e3cfe0e814d3506fced34ab7696
2 files changed +106 -1
apps/web/src/components/chat/ComposerPendingUserInputPanel.browser.test.tsx new
+103
@@ -0,0 +1,103 @@
1 +import { EnvironmentId, RuntimeRequestId, ThreadId } from "@t3tools/contracts";
2 +import type { ReactNode } from "react";
3 +import { expect, it, vi } from "vite-plus/test";
4 +import { userEvent } from "vite-plus/test/browser";
5 +
6 +import { render } from "../../../test/render";
7 +import type { PendingUserInput } from "../../session-logic";
8 +import { Select, SelectTrigger } from "../ui/select";
9 +import { ComposerPendingUserInputPanel } from "./ComposerPendingUserInputPanel";
10 +
11 +const threadRef = { environmentId: EnvironmentId.make("env"), threadId: ThreadId.make("thread") };
12 +
13 +const prompt: PendingUserInput = {
14 + requestId: RuntimeRequestId.make("question-shortcuts"),
15 + createdAt: "2026-10-31T00:00:00.000Z",
16 + dismissible: false,
17 + responseCapability: "live",
18 + questions: [
19 + {
20 + id: "question",
21 + header: "Rollout",
22 + question: "How should this ship?",
23 + options: [{ label: "Incremental", description: "One module at a time" }],
24 + multiSelect: true,
25 + },
26 + ],
27 +};
28 +
29 +it.each<{ focus: string; control: ReactNode; toggles: boolean }>([
30 + { focus: "a page button", control: <button type="button" aria-label="Focused" />, toggles: true },
31 + {
32 + focus: "a dialog",
33 + control: (
34 + <div role="dialog">
35 + <button type="button" aria-label="Focused" />
36 + </div>
37 + ),
38 + toggles: false,
39 + },
40 + {
41 + focus: "a popup",
42 + control: (
43 + <div data-slot="menu-popup">
44 + <button type="button" aria-label="Focused" />
45 + </div>
46 + ),
47 + toggles: false,
48 + },
49 + {
50 + focus: "a menu",
51 + control: (
52 + <div role="menu">
53 + <button type="button" role="menuitem" aria-label="Focused" />
54 + </div>
55 + ),
56 + toggles: false,
57 + },
58 + {
59 + focus: "a select",
60 + control: (
61 + <select aria-label="Focused">
62 + <option>One</option>
63 + </select>
64 + ),
65 + toggles: false,
66 + },
67 + {
68 + focus: "a closed select menu",
69 + control: (
70 + <Select>
71 + <SelectTrigger aria-label="Focused" />
72 + </Select>
73 + ),
74 + toggles: false,
75 + },
76 +])(
77 + "digit shortcut with focus in $focus toggles an option: $toggles",
78 + async ({ control, toggles }) => {
79 + const onToggleOption = vi.fn();
80 + await using screen = await render(
81 + <>
82 + {control}
83 + <ComposerPendingUserInputPanel
84 + pendingUserInputs={[prompt]}
85 + cwd={undefined}
86 + threadRef={threadRef}
87 + respondingRequestIds={[]}
88 + answers={{}}
89 + questionIndex={0}
90 + onToggleOption={onToggleOption}
91 + onAdvance={vi.fn()}
92 + onDismiss={vi.fn()}
93 + />
94 + </>,
95 + );
96 + await expect.element(screen.getByText("Incremental")).toBeVisible();
97 + screen.getByLabelText("Focused").element().focus();
98 +
99 + await userEvent.keyboard("1");
100 +
101 + expect(onToggleOption.mock.calls).toEqual(toggles ? [["question", "Incremental"]] : []);
102 + },
103 +);
apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx
+3 -1
@@ -159,7 +159,9 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
159 }
160 if (
161 target instanceof HTMLElement &&
162 - target.closest('[contenteditable]:not([contenteditable="false"])')
162 + target.closest(
163 + 'select, [contenteditable]:not([contenteditable="false"]), [role="dialog"], [aria-modal="true"], [role="menu"], [role="combobox"], [data-slot$="popup"]',
164 + )
165 ) {
166 return;
167 }