[Bug]: Text in a pending question card (AskUserQuestion) can't be selected or copied#16821

opened19d agobyPpalkovicsakos

Version: T3 Code Nightly 0.0.46-nightly.20261006.2735, macOS desktop, Claude Agent provider

What happens When an agent asks a question through AskUserQuestion, the card that appears above the composer shows the question and the option labels and descriptions. None of that text can be selected. Click-dragging does nothing, and Cmd+C copies nothing. The only way to get the text out is a screenshot.

Why it matters These cards often contain the very thing you need to paste somewhere else: a ticket ID, a command, a path, or the agent's summary of what it is about to do. Ordinary assistant messages in the timeline can be selected; question cards are the one place where they can't.

Steps to reproduce

  1. In a Claude thread, ask the agent to call AskUserQuestion with a question and 2+ options.
  2. When the card appears, try to select the question text or an option description with the mouse.
  3. Try Cmd+C.

Expected: the question and option text can be selected and copied like any other message text (clicking an option can still select it; dragging should select text). Actual: no selection is possible and nothing is copied.

Related (different bugs, same card): #5454, #15517, #14237.

Note

Grok responding on behalf of Julius.

Thanks for the report. I can reproduce this from the code. Two things block selection in the pending-question card (apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx, on current main):

Root cause

  1. Option label and description are inside a <button> (ComposerPendingUserInputPanel.tsx:293-303, content at :272-277). Chromium/Electron won't start a drag selection inside a button, and any mousedown there turns into a click, so handleOptionSelection (:297-299) runs.
  2. The question text is caught by the composer form's pointer handler. The card renders inside the composer <form> (ChatComposer.tsx:6680/:6701). Its onPointerDownCapture (ChatComposer.tsx:6550-6568) ignores buttons, but for any other target it calls event.preventDefault() while the composer is resting (:6561-6565) so it can refocus the editor. Calling preventDefault on pointerdown stops a native text selection from starting, so the question <p> (ComposerPendingUserInputPanel.tsx:249) can't be selected either. The collapsed header is also a <button> trigger (:197-213), so the truncated question there can't be selected.

Proposed fix

  • In the form's onPointerDownCapture, return early for targets inside the pending-question panel (for example a data-pending-user-input-body marker), or at least for non-editor text.
  • Make the option rows not native buttons: use role="button"/role="radio" on a div with tabIndex, keep keyboard handling and the 1-9 shortcuts, and add select-text cursor-text on the label and description spans. Another option is to keep the button and render the description outside it.
  • In the option's onClick, skip selection when the user dragged out a selection: if (window.getSelection()?.toString()) return;, or compare the pointerdown/pointerup positions. Clicking an option still selects it, and drag-select plus Cmd+C works.
  • Add a test in ComposerPendingUserInputPanel.test.tsx that a click with a non-empty selection doesn't call the selection handler.

Workaround None in the card itself for now; a screenshot is the only reliable way to get the text out until the fix lands.

Overlap: #5454 (closed, dismiss after session death), #15517 (stale question after steering) and #14237 (option preview dropped) all touch this card but not text selection, so this isn't a duplicate.

Synced from GitHub

Hi, I'd like to take this. I traced the same two causes as the triage: the composer form's onPointerDownCapture preventing default on the question text, and the option rows being native buttons. My plan is to add a selectable-text scope next to the existing composer event-scope helpers so the pointer handler skips it, and to render the options as role="button" rows with selectable text. A drag-selection won't trigger the option, while a plain click and the 1–9 shortcuts will still work. I'll add tests and a before/after recording. If you'd rather scope it differently, for example question text only first, tell me. I'll wait for a go-ahead before opening a PR.

Reproduced on Linux Chromium in the real web app at a12d6ed942: dragging option labels/descriptions selected no text and toggled the option. Question prose was already selectable here. #23178 adds selectable options and preserves click/keyboard activation, with before/after recordings and coverage limits. Native macOS/Electron remains unverified; the PR requires Julius review.