feat(web): collapse the question prompt from its header #6773
main fromrefs/pull/6773/head·merged by juliusmarminge View on GitHubWhat Changed#
The pending-question panel above the composer (ComposerPendingUserInputPanel) can now be collapsed from its header.
- The header row is a disclosure control, built on the existing
~/components/ui/collapsibleprimitive. Clicking it hides the question, the multi-select hint and the option list; clicking it again restores them. - Collapsed, the header keeps its section label and question counter and echoes the question itself on one truncated line, so the strip still says what is being asked.
- A chevron marks the affordance and points at the body: down while it is open, up while it is collapsed.
- Collapsed prompts stop listening for the
1–9option shortcuts, since the numbers they refer to are off screen. The composer's custom-answer field keeps working, so a prompt can still be answered while collapsed. - The collapsed question's id is stored rather than a bare flag, so a prompt that advances to its next question reopens. That matters because it happens without a click — sending from the composer advances the active question.
One file of behavior plus a test file. No contract, server or provider surface is touched.
Why#
Resolves #4431. When a question has a long body or many options, the panel grows tall enough to cover most of the thread, so the reasoning that led to the question is hard to read while answering it. On a laptop that is most of the window.
Collapsing to the header is the smallest thing that fixes it: the prompt stays visible and answerable, but it stops competing with the thread for space. Mobile already has an expand/collapse choreography for its own PendingUserInputCard (pendingUserInputLayout.ts); this closes the same gap on web.
UI Changes#
Before#
The question covers the entire thread:
After#
There is a chevron icon indicating that clicking the header will collapse the panel:
Collapsed panel after clicking the header:
Video#
https://github.com/user-attachments/assets/cae1e446-1372-42ba-90e8-199694b887bb
In words: expanded is unchanged from today. Collapsed, the panel is a single header row — uppercase section label, the 1/2 counter when a prompt has several questions, the question on one truncated line, and the chevron on the right — sitting on the composer's top edge where the full panel used to be. Open and close run through the collapsible's standard 200ms height transition; there is no continuous animation.
Checklist#
- This PR is small and focused
- I explained what changed and why
- I included before/after screenshots for any UI changes — to follow, see above
- I included a video for animation/interaction changes — the only motion is the shared collapsible's existing height transition
Two things worth flagging for review rather than leaving you to find them:
- No test covers the collapsed branch.
apps/webtests run in the node environment withrenderToStaticMarkupand no DOM, so nothing there can click the trigger. The alternative was adefaultCollapsedprop existing purely for the test, which seemed worse than the gap; since the disclosure is built on the shared primitive, the open/close mechanics and the ARIA wiring are covered by it rather than by this file. Happy to add the prop if you would rather have the assertion. - Crossing the mobile composer's collapsed/expanded boundary reopens the prompt.
ChatComposerrenders this panel from two mutually exclusive branches, so focusing or blurring the mobile composer remounts the card and drops the collapsed state. Fixing it means lifting the state intoChatComposer, which widens the diff past the requested change, so I left it. Say the word if you want it in scope.
🤖 Generated with Claude Code (Claude Opus 5)
Note
Low Risk Scoped UI change in the composer pending-question panel; no API, auth, or data-path changes.
Overview The composer pending user input panel can be collapsed from its header so long questions and option lists stop covering the chat thread.
The section header becomes a disclosure control (shared Collapsible primitive): expanded behavior matches today; collapsed keeps the label, multi-question counter, a one-line truncated question, and a chevron. Number-key (1–9) shortcuts are disabled while collapsed because options are hidden; composer custom answers still work.
Collapse state is tracked by active question id, so when the prompt advances to the next question (including via composer send) the card reopens without a manual expand. New static markup tests assert the header is an accessible toggle (aria-expanded, aria-controls) and that the panel starts expanded.
Note
Add collapsible toggle to question prompt header in chat composer#
- Each prompt card header in
ComposerPendingUserInputCardis now a button that collapses or expands the question body, starting expanded by default. - When collapsed, a one-line truncated question is shown in the header and a chevron icon rotates to indicate state; a
data-pending-user-input-toggleattribute reflects "collapsed" or "expanded". - Number-key selection shortcuts are disabled when the panel is collapsed to prevent selecting hidden options.
- Adds a test in ComposerPendingUserInputPanel.test.tsx asserting initial expanded state and correct ARIA attributes on the trigger.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved c26aed8
This PR adds a straightforward UI enhancement (collapsibility) to an existing panel using existing UI primitives. Changes are self-contained with tests and appropriate accessibility handling.
You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).juliusmarminge merged this40ab7bf
juliusmarminge closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
91326431-e031-4b27-b1bc-795955bd7ae8You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share