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

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

fix(clients): Claude question option previews are shown under their option (#34784)

Julius Marminge committed Nov 12, 2026 at 00:08 UTC d8b0a05a74dfb8d19c12b532f8e5d1b8831311d2
4 files changed +100 -52
apps/mobile/src/features/threads/PendingUserInputCard.tsx
+49 -34
@@ -81,6 +81,7 @@ function QuestionText(props: {
81 readonly threadId: ThreadId;
82 readonly workspaceRoot: string | null;
83 readonly setDirection: TextDirection | undefined;
84 + readonly preserveSoftBreaks?: boolean;
85 }) {
86 const styles = useMarkdownPreviewStyles();
87 const markdown = useLiveThreadLinkLabels(props.markdown, props.environmentId);
@@ -113,6 +114,7 @@ function QuestionText(props: {
114 Platform.OS === "android" ? undefined : props.setDirection === "rtl" ? "right" : "left"
115 }
116 onLinkPress={openLink}
117 + preserveSoftBreaks={props.preserveSoftBreaks}
118 />
119 );
120 }
@@ -279,43 +281,56 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
281 const description =
282 option.description !== option.label ? option.description : undefined;
283 return (
282 - <Pressable
283 - key={optionValue}
284 - accessibilityRole={question.multiSelect ? "checkbox" : "radio"}
285 - accessibilityState={{ checked: selected, disabled: responseDisabled }}
286 - disabled={responseDisabled}
287 - className={cn(
288 - "min-h-12 w-full rounded-2xl border px-3.5 py-3",
289 - selected ? "border-primary bg-primary/10" : "border-border bg-input",
290 - )}
291 - onPress={() =>
292 - props.onSelectOption(
293 - props.pendingUserInput.requestId,
294 - question,
295 - optionValue,
296 - )
297 - }
298 - >
299 - <View className="min-w-0 flex-1 gap-0.5">
300 - <Text
301 - className={cn(
302 - "font-t3-bold text-sm",
303 - selected ? "text-foreground" : "text-foreground-secondary",
304 - )}
305 - style={proseDirectionStyle(option.label, setDirection)}
306 - >
307 - {option.label}
308 - </Text>
309 - {description ? (
284 + <View key={optionValue} className="gap-1.5">
285 + <Pressable
286 + accessibilityRole={question.multiSelect ? "checkbox" : "radio"}
287 + accessibilityState={{ checked: selected, disabled: responseDisabled }}
288 + disabled={responseDisabled}
289 + className={cn(
290 + "min-h-12 w-full rounded-2xl border px-3.5 py-3",
291 + selected ? "border-primary bg-primary/10" : "border-border bg-input",
292 + )}
293 + onPress={() =>
294 + props.onSelectOption(
295 + props.pendingUserInput.requestId,
296 + question,
297 + optionValue,
298 + )
299 + }
300 + >
301 + <View className="min-w-0 flex-1 gap-0.5">
302 <Text
311 - className="font-sans text-sm leading-5 text-foreground-muted"
312 - style={proseDirectionStyle(description, setDirection)}
303 + className={cn(
304 + "font-t3-bold text-sm",
305 + selected ? "text-foreground" : "text-foreground-secondary",
306 + )}
307 + style={proseDirectionStyle(option.label, setDirection)}
308 >
314 - {description}
309 + {option.label}
310 </Text>
316 - ) : null}
317 - </View>
318 - </Pressable>
311 + {description ? (
312 + <Text
313 + className="font-sans text-sm leading-5 text-foreground-muted"
314 + style={proseDirectionStyle(description, setDirection)}
315 + >
316 + {description}
317 + </Text>
318 + ) : null}
319 + </View>
320 + </Pressable>
321 + {option.preview ? (
322 + <View className="px-3.5">
323 + <QuestionText
324 + markdown={option.preview}
325 + environmentId={props.environmentId}
326 + threadId={props.threadId}
327 + workspaceRoot={props.workspaceRoot}
328 + setDirection={setDirection}
329 + preserveSoftBreaks
330 + />
331 + </View>
332 + ) : null}
333 + </View>
334 );
335 })}
336 </View>
apps/web/src/components/chat/ComposerPendingUserInputPanel.direction.browser.test.tsx
+23 -1
@@ -11,7 +11,7 @@ import { ComposerPendingUserInputPanel } from "./ComposerPendingUserInputPanel";
11 type Question = {
12 header: string;
13 question: string;
14 - options: { label: string; description: string }[];
14 + options: { label: string; description: string; preview?: string }[];
15 };
16
17 const renderPanel = (questions: Question[], questionIndex = 0) =>
@@ -98,3 +98,25 @@ it("keeps one direction for the whole set when a single question is Hebrew", asy
98 .element(screen.getByText("גרסה 3 (חדשה!)", { exact: true }))
99 .toHaveStyle({ direction: "rtl" });
100 });
101 +
102 +it("shows an option's preview so the user can see what they are approving", async () => {
103 + await using screen = await renderPanel([
104 + {
105 + header: "Issue",
106 + question: "Approve this issue title and body?",
107 + options: [
108 + {
109 + label: "Approve",
110 + description: "File it as drafted.",
111 + preview: "Title: Login fails\n\nBody: A quote in the password breaks login.",
112 + },
113 + { label: "Cancel", description: "Do not file it." },
114 + ],
115 + },
116 + ]);
117 +
118 + await screen.getByRole("button", { name: /Approve/ }).hover();
119 + await expect
120 + .element(screen.getByText("A quote in the password breaks login.", { exact: false }))
121 + .toBeVisible();
122 +});
apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx
+23 -12
@@ -310,19 +310,30 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
310 ) : null}
311 </>
312 );
313 + // The preview sits outside the button: it can hold links, and a click on a single-select option advances.
314 return (
314 - <button
315 - key={`${activeQuestion.id}:${optionValue}`}
316 - type="button"
317 - aria-pressed={isSelected}
318 - disabled={disabled || isResponding}
319 - onClick={() => {
320 - handleOptionSelection(activeQuestion.id, optionValue);
321 - }}
322 - className={className}
323 - >
324 - {content}
325 - </button>
315 + <div key={`${activeQuestion.id}:${optionValue}`}>
316 + <button
317 + type="button"
318 + aria-pressed={isSelected}
319 + disabled={disabled || isResponding}
320 + onClick={() => {
321 + handleOptionSelection(activeQuestion.id, optionValue);
322 + }}
323 + className={className}
324 + >
325 + {content}
326 + </button>
327 + {option.preview ? (
328 + <ChatMarkdown
329 + text={option.preview}
330 + cwd={cwd}
331 + threadRef={threadRef}
332 + lineBreaks
333 + className="ps-9 pe-2 pb-1.5 text-xs text-foreground/70 sm:ps-8"
334 + />
335 + ) : null}
336 + </div>
337 );
338 })}
339 </div>
apps/web/src/pendingUserInput.ts
+5 -5
@@ -42,9 +42,9 @@ export function threadContextsReferencedByAnswer(
42 return threadContexts.filter((record) => referencedIds.has(record.contextId));
43 }
44
45 -export interface PendingUserInputProgress {
45 +export interface PendingUserInputProgress<Q extends UserInputQuestion = UserInputQuestion> {
46 questionIndex: number;
47 - activeQuestion: UserInputQuestion | null;
47 + activeQuestion: Q | null;
48 activeDraft: PendingUserInputDraftAnswer | undefined;
49 selectedOptionValues: ReadonlyArray<string>;
50 customAnswer: string;
@@ -83,11 +83,11 @@ function countAnsweredPendingUserInputQuestions(
83 }, 0);
84 }
85
86 -export function derivePendingUserInputProgress(
87 - questions: ReadonlyArray<UserInputQuestion>,
86 +export function derivePendingUserInputProgress<Q extends UserInputQuestion>(
87 + questions: ReadonlyArray<Q>,
88 draftAnswers: Record<string, PendingUserInputDraftAnswer>,
89 questionIndex: number,
90 -): PendingUserInputProgress {
90 +): PendingUserInputProgress<Q> {
91 const normalizedQuestionIndex =
92 questions.length === 0 ? 0 : Math.max(0, Math.min(questionIndex, questions.length - 1));
93 const activeQuestion = questions[normalizedQuestionIndex] ?? null;