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

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

fix(web): question options show a radio and an aligned shortcut key (#23255)

maria committed Oct 25, 2026 at 19:43 UTC d414cb51032f302c268ebd11a486240139dfd3c0
2 files changed +84 -38
apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx
+50 -32
@@ -7,8 +7,9 @@ import {
7 derivePendingUserInputProgress,
8 type PendingUserInputDraftAnswer,
9 } from "../../pendingUserInput";
10 -import { CheckIcon } from "lucide-react";
10 +import { CheckboxMark } from "../ui/checkbox";
11 import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "../ui/collapsible";
12 +import { Kbd } from "../ui/kbd";
13 import { cn } from "~/lib/utils";
14 import { ComposerBanner } from "./ComposerBanner";
15 import ChatMarkdown from "../ChatMarkdown";
@@ -189,23 +190,24 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
190 isCollapsed ? "Show the question and its options" : "Hide the question and its options"
191 }
192 data-pending-user-input-toggle={isCollapsed ? "collapsed" : "expanded"}
193 + className="px-4 pt-1.5"
194 >
193 - <ComposerBanner.Icon />
195 <ComposerBanner.Content>
195 - <span className="shrink-0 font-medium text-muted-foreground">
196 - {activeQuestion.header}
197 - </span>
196 + <span className="shrink-0 text-muted-foreground">{activeQuestion.header}</span>
197 {isCollapsed ? (
199 - <span className="min-w-0 flex-1 truncate text-secondary-label">
200 - {activeQuestion.question}
201 - </span>
198 + <>
199 + <ComposerBanner.Separator />
200 + <span className="min-w-0 flex-1 truncate text-secondary-label">
201 + {activeQuestion.question}
202 + </span>
203 + </>
204 ) : null}
205 </ComposerBanner.Content>
204 - <ComposerBanner.Actions>
206 + <ComposerBanner.Actions className="gap-0">
207 {prompt.questions.length > 1 ? (
206 - <span className="text-3xs font-medium text-muted-foreground tabular-nums">
208 + <ComposerBanner.Count>
209 {questionIndex + 1}/{prompt.questions.length}
208 - </span>
210 + </ComposerBanner.Count>
211 ) : null}
212 <ComposerBanner.ToggleIcon expanded={!isCollapsed} />
213 {prompt.dismissible ? (
@@ -232,17 +234,15 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
234 </CollapsibleTrigger>
235 <CollapsiblePanel>
236 <ComposerBanner.Scroll>
235 - <ComposerBanner.Body className="pe-1 pb-1 wrap-anywhere">
237 + <ComposerBanner.Body className="ps-6 pe-4 pb-1 wrap-anywhere sm:ps-5.5">
238 <ChatMarkdown
239 text={activeQuestion.question}
240 cwd={cwd}
241 threadRef={threadRef}
240 - className="text-foreground/85"
242 + className="pt-2 text-foreground/85"
243 />
242 - {activeQuestion.multiSelect ? (
243 - <p className="mt-1 text-secondary-label text-xs">Select one or more options.</p>
244 - ) : null}
245 - <div className="mt-2 space-y-0.5">
244 + {/* Rows span the header row's width so the radios align with the question text and the shortcut column sits under the dismiss button. */}
245 + <div className="-ms-2 mt-1.5 sm:-ms-1.5">
246 {activeQuestion.options.map((option, index) => {
247 const optionValue = option.value ?? option.label;
248 const isOptimisticallySelected =
@@ -250,33 +250,32 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
250 optimisticSingleSelect.optionValue === optionValue;
251 const isSelected =
252 isOptimisticallySelected || draftSelectedOptions?.[index] === true;
253 - const shortcutKey = index < 9 ? index + 1 : null;
253 const className = cn(
255 - "group flex w-full items-center gap-2 rounded-md px-2.5 py-2 text-left outline-none transition-colors duration-150 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary/25",
256 - isSelected
257 - ? "bg-muted/55 text-foreground"
258 - : "bg-transparent text-foreground/85 hover:bg-muted/30",
254 + "group flex w-full items-start gap-2.5 rounded-md bg-transparent py-1.5 ps-2 text-left sm:ps-1.5 outline-none transition-colors duration-150 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary/25",
255 + isSelected ? "text-foreground" : "text-foreground/70 hover:bg-muted/30",
256 (disabled || isResponding) && "opacity-50 cursor-not-allowed",
257 !disabled && !isResponding && "cursor-pointer",
258 );
259 + // The h-5 slots match the label's line box, so the indicator and shortcut stay on its first line.
260 const content = (
261 <>
262 + <span className="pointer-events-none flex h-5 shrink-0 items-center">
263 + {activeQuestion.multiSelect ? (
264 + <CheckboxMark checked={isSelected} />
265 + ) : (
266 + <OptionRadio checked={isSelected} />
267 + )}
268 + </span>
269 <div className="min-w-0 flex-1 flex flex-col gap-0.5">
270 <span className="text-sm font-medium">{option.label}</span>
271 {option.description && option.description !== option.label ? (
272 <span className="text-secondary-label text-2xs">{option.description}</span>
273 ) : null}
274 </div>
270 - {isSelected ? (
271 - <CheckIcon className="size-3.5 shrink-0 text-primary" />
272 - ) : shortcutKey !== null ? (
273 - <kbd
274 - className={cn(
275 - "flex size-5 shrink-0 items-center justify-center text-3xs font-medium text-muted-foreground tabular-nums",
276 - )}
277 - >
278 - {shortcutKey}
279 - </kbd>
275 + {index < 9 ? (
276 + <span className="flex h-5 w-7 shrink-0 items-center justify-center sm:w-6">
277 + <Kbd>{index + 1}</Kbd>
278 + </span>
279 ) : null}
280 </>
281 );
@@ -284,6 +283,7 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
283 <button
284 key={`${activeQuestion.id}:${optionValue}`}
285 type="button"
286 + aria-pressed={isSelected}
287 disabled={disabled || isResponding}
288 onClick={() => {
289 handleOptionSelection(activeQuestion.id, optionValue);
@@ -301,3 +301,21 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
301 </Collapsible>
302 );
303 });
304 +
305 +// Drawn with ui/radio-group's look instead of using its Radio: Radio only checks inside a
306 +// RadioGroup, whose arrow keys select options and would trip the single-select auto-advance.
307 +function OptionRadio({ checked }: { checked: boolean }) {
308 + return (
309 + <span
310 + aria-hidden
311 + className={cn(
312 + "relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-full border border-input bg-background not-dark:bg-clip-padding sm:size-4 dark:bg-input/32",
313 + checked ? "shadow-none" : "shadow-xs/5",
314 + )}
315 + >
316 + {checked ? (
317 + <span className="-inset-px absolute flex items-center justify-center rounded-full bg-primary before:size-2 before:rounded-full before:bg-primary-foreground sm:before:size-1.5" />
318 + ) : null}
319 + </span>
320 + );
321 +}
apps/web/src/components/ui/checkbox.tsx
+34 -6
@@ -2,19 +2,22 @@ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
2
3 import { cn } from "~/lib/utils";
4
5 +const rootClassName =
6 + "relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:outline-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:focus-visible:aria-invalid:outline-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none";
7 +
8 +const indicatorClassName =
9 + "-inset-px absolute flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground in-[[data-slot=checkbox]:focus-visible]:inset-shadow-[0_0_0_3px_var(--background)] in-[[data-slot=checkbox]:focus-visible]:outline-2 in-[[data-slot=checkbox]:focus-visible]:outline-solid in-[[data-slot=checkbox]:focus-visible]:-outline-offset-2 in-[[data-slot=checkbox]:focus-visible]:outline-inherit";
10 +
11 function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
12 return (
13 <CheckboxPrimitive.Root
8 - className={cn(
9 - "relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:outline-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:focus-visible:aria-invalid:outline-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none",
10 - className,
11 - )}
14 + className={cn(rootClassName, className)}
15 data-slot="checkbox"
16 {...props}
17 >
18 {/* Keep an inner gap in the focus outline. Explicit glyph colors resist row icon-muting rules. */}
19 <CheckboxPrimitive.Indicator
17 - className="-inset-px absolute flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground in-[[data-slot=checkbox]:focus-visible]:inset-shadow-[0_0_0_3px_var(--background)] in-[[data-slot=checkbox]:focus-visible]:outline-2 in-[[data-slot=checkbox]:focus-visible]:outline-solid in-[[data-slot=checkbox]:focus-visible]:-outline-offset-2 in-[[data-slot=checkbox]:focus-visible]:outline-inherit"
20 + className={indicatorClassName}
21 data-slot="checkbox-indicator"
22 render={(props, state) => (
23 <span {...props}>
@@ -56,4 +59,29 @@ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
59 );
60 }
61
59 -export { Checkbox };
62 +// Checkbox's look without its hidden input, for a row that is itself the button.
63 +function CheckboxMark({ checked }: { checked: boolean }) {
64 + const state = checked ? { "data-checked": "" } : { "data-unchecked": "" };
65 + return (
66 + <span aria-hidden className={rootClassName} data-slot="checkbox" {...state}>
67 + <span className={indicatorClassName} data-slot="checkbox-indicator" {...state}>
68 + <svg
69 + className="size-3.5 text-current sm:size-3"
70 + fill="none"
71 + height="24"
72 + stroke="currentColor"
73 + strokeLinecap="round"
74 + strokeLinejoin="round"
75 + strokeWidth="3"
76 + viewBox="0 0 24 24"
77 + width="24"
78 + xmlns="http://www.w3.org/2000/svg"
79 + >
80 + <path d="M5.252 12.7 10.2 18.63 18.748 5.37" />
81 + </svg>
82 + </span>
83 + </span>
84 + );
85 +}
86 +
87 +export { Checkbox, CheckboxMark };