Repository navigation
fix(native-chat): let the "Asked" row unfold a long question - #22941
Conversation
The question row clipped long questions to one line with no way to read the rest. The row is now a toggle that wraps the full question in place.
There was a problem hiding this comment.
ℹ️ No critical issues — one rough edge worth a look.
Reviewed changes
- Expandable single-question row —
NativeChatAwaitingInputRownow renders asubject.kind === 'question'row as a<button>toggling the text betweentruncateandwhitespace-pre-wrap break-words, witharia-expanded, a hover chevron (group/ask-row), and the same focus ring as the tool-run header; count and subject-null rows stay a plain<div>. - Tests — added an unfold/fold test (
aria-expanded+truncateclass swap) and a "count row offers no toggle" test; the settled-ask header check now targets[data-native-chat-tool-run-state]because the ask row is itself a button.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughQuestion rows measure whether their text is clipped and show a disclosure toggle when needed. Opening a row displays the full question below the header. Stable disclosure keys preserve open state across remounts and pending-to-resolved receipt updates. Non-question rows remain non-interactive. Priority: ⬇️ Low Merge Risk: 🔵 Low · up to Screen-reader users may have difficulty distinguishing open question controls. The issue is localized and can be fixed before merge or accepted as a bounded follow-up. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Questions remain in the same chat, but their open state now survives row replacement. It is not established whether that state always resets when a different conversation is shown. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
The first cut put the whole question inside the toggle button, where Chromium will not select text: dragging or double-clicking in it selected nothing and toggled the row instead. The open state also lived in the row, so scrolling the row out of the windowed transcript, or answering the question, folded it again. - The full question now opens in a paragraph below the button, outside it, so it selects and copies like any other prose. - The toggle is offered only when the question is actually clipped; a question that fits stays plain, selectable text as before. - Open state is kept in the transcript's disclosure store, keyed by the message, so it survives windowing and the pending-to-answered remount. - The chevron also shows on keyboard focus and on touch screens.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 612ca67f-cde2-4a05-b5ad-ae604f360bbe
📒 Files selected for processing (6)
src/renderer/src/components/native-chat/NativeChatAwaitingInputRow.tsxsrc/renderer/src/components/native-chat/NativeChatResolutionReceipt.test.tsxsrc/renderer/src/components/native-chat/NativeChatResolutionReceipt.tsxsrc/renderer/src/components/native-chat/NativeChatToolRun.ask-row.test.tsxsrc/renderer/src/components/native-chat/NativeChatToolRun.tsxsrc/renderer/src/components/native-chat/NativeChatTranscriptRow.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| <span className={cn('shrink-0', pending && 'animate-pulse motion-reduce:animate-none')}> | ||
| {label} | ||
| </span> | ||
| {toggles && open ? null : ( |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Keep the question in the toggle’s accessible name.
When the row opens, this branch removes the question from the button. Multiple open rows then expose identical “Asked:” buttons to screen-reader button navigation. Give the button a localized accessible name that retains question in both states, while keeping the visible full text outside the button.
There was a problem hiding this comment.
ℹ️ No critical issues — one focus rough edge inline.
Reviewed changes
- Open below the toggle —
NativeChatAwaitingInputRownow draws the full question in a<p>under the row instead of unfolding it inside the button, so the text stays selectable and copyable while the toggle keeps its identity. - Measured clipping — the row measures its question (
scrollWidth > clientWidth, re-checked by aResizeObserver) so only a genuinely clipped question becomes a toggle; a question that fits stays plain text. - Persistent disclosure — open state moved from local
useStateintouseNativeChatDisclosure, keyedask:<messageId>from bothNativeChatToolRunandNativeChatResolutionReceipt, so an opened question survives windowing remounts and the pending-to-answered remount. - Tests — added clipped open/fold, remount persistence, short-question plain-text, and receipt pending→answered persistence cases; the receipt suite drives the real disclosure provider.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| }, []) | ||
|
|
||
| const question = subject?.kind === 'question' ? subject.text : null | ||
| const toggles = question !== null && (open || clipped) |
There was a problem hiding this comment.
An open row stops measuring — the question span and its ResizeObserver unmount while open is true — so clipped goes stale. If the pane grows enough that the question would now fit, folding re-measures clipped as false and swaps the button for a <div> in the same commit; because the fold click is what focused it, the focused button unmounts and focus falls to <body>. I reproduced this with the file's own harness (stub widths to clip, open, widen, fold → activeElement is body), which contradicts the intent noted on line 40.
Technical details
# Focus is lost when a widened question is folded
## Affected sites
- `src/renderer/src/components/native-chat/NativeChatAwaitingInputRow.tsx:61` — `toggles = question !== null && (open || clipped)`; `clipped` is never re-measured while open because the span (and observer) are unmounted.
- `src/renderer/src/components/native-chat/NativeChatAwaitingInputRow.tsx:45-58` — `measureLine` runs only while the span is mounted (i.e. collapsed).
## Required outcome
- Folding an open, previously-clipped question does not move keyboard focus off the control when the question has since stopped being clipped.
## Suggested approach
- Keep the toggle when the row currently holds focus, or re-measure on fold before demoting to plain text, so the swap cannot race the fold click.
## Open questions for the human
- Acceptable as-is given the narrow trigger (pane must widen while the question is open), or worth the guard?
Review status: ready for reviewHead: What changed during review. The first version wrapped the whole question inside the toggle button. Chromium does not select text inside a
Review loops. Loop 1 found the three problems above and made the redesign. Loop 2 reviewed the redesign independently and came back clean. That loop checked:
A separate architecture challenge was not needed, because review converged in two loops without repeated issues. Readiness checks. Both passed with no P0 or P1 issues. The two P2s from the first check are fixed: text inside the button could not be selected, and short questions got a toggle that did nothing. Live QA. Run against a background dev build of this head on a second Mac, with an isolated profile. Everything passed:
Screenshots are in the PR body under Visual Proof. Known and accepted:
Not caused by this PR (possible follow-ups):
|

ELI5
When an agent asks you a question in a chat, the chat keeps a one-line "Asked: …" record of it. A long question was cut off with "…" and there was no way to read the rest. Now, when a question is cut off, you can click the row to show the whole question underneath, where you can read, select and copy it. Click again to fold it back.
What Changed
Before: the "Asked:" / "Awaiting user input:" row always showed the question on one line and cut off anything past the width of the pane.
After: when the question does not fit on the line, the row becomes a button (chevron on hover or keyboard focus). Clicking it shows the full question in a wrapped paragraph under the row and turns the row into "Asked:" with a downward chevron; clicking the row again folds it. A question that already fits stays plain text exactly as before, and a row that only says "N questions" is never a toggle. An opened question stays open when you scroll it out of view and back, and when you answer it.
Mechanism:
<button>: a drag or double-click there selects nothing and fires a click, so a question drawn inside the toggle could be read but not copied.NativeChatAwaitingInputRowmeasures its question (scrollWidth > clientWidth, re-checked by aResizeObserverwhile the question sits on the line, the same check the sidebar's truncated labels use) and only offers the toggle when the question is actually clipped.useNativeChatDisclosure), keyedask:<message id>from both the tool run and the question receipt, the same way tool runs and tool lines remember their state. The transcript is windowed, so state kept inside the row was lost whenever the row scrolled out of view; the receipt also remounts when the question is answered.Why
After a question is answered, this row is the only place in the transcript that still shows it, so a question that was cut off could not be read again. Click-to-expand over a tooltip: a tooltip cannot be selected or read comfortably when the question runs to several lines. Body-below-the-toggle over unfolding the text inside the toggle: the text must stay selectable (drag, double-click, triple-click), and keeping it out of the button gives that with a plain native button and no selection special-casing. It is also how the tool-run rows in the same transcript work: a one-line header button with its content below. The cost is that the chevron moves from the end of the clipped line to just after "Asked:" when the row opens. Measuring only the few question rows that are mounted is cheap, and it avoids a toggle that does nothing on a short question, which would also have made that short question unselectable.
Linked Issue
None. Reported directly from a screenshot of a settled Claude question.
Visual Proof
Checked live in a background dev build of this branch (head
24e63adb2a) on a second Mac, with an isolated profile and a seeded Claude transcript. After shots only: before this change the same row is the clipped one-line version with no way to open it.Clipped question, collapsed, with the chevron on hover:

Opened: the full question below the header, and a drag-selection inside it that leaves the row open:

A question that fits stays plain text with no chevron; an "N questions" row never toggles:

Keyboard focus shows the ring and chevron:

Still open after scrolling far enough to unmount the row and back:

The same medium question is plain text in a wide pane and becomes a toggle in a narrow one:

Opened while pending, then still open once the answer lands and the label becomes "Asked:":

Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
NativeChatToolRun.ask-row.test.tsx: a question that fits stays plain text with no button; a clipped question opens below the button (outside it), a click in the opened text does not fold it, and the button folds it back; an opened question stays open across an unmount/remount through the disclosure store, and folding it keeps keyboard focus on the same button; an "N questions" row never toggles.NativeChatResolutionReceipt.test.tsx: a question opened while pending is still open after it is answered.Each new test fails with its mechanism removed (store key dropped, clipping check dropped, remount seed dropped).
All native-chat renderer tests pass.
pnpm tc:web,check:code-quality:changed(including React Doctor and the design system check),check:react-doctor:changed,check:dead-classesandoxlinton the touched folder pass.In headless Chrome: text inside a
<button>selects nothing on drag, double-click or triple-click, and the drag fires a click; the same text outside a button selects normally.Live check in the running app (dev build, background, isolated profile): every scenario shown under Visual Proof passed, covering clipped/open/select/fold, short and multi-question rows staying plain, keyboard (Tab, Enter, Space), scroll-away-and-back, pane resize, and pending to answered.
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Renderer-only presentation change. No wire, SSH or platform-specific behavior. Mobile draws its own row and is unchanged; the shared ask-row copy and subject types are untouched.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)