fix(app): collapse reasoning section with its message #335

Merged
rwachters merged 1 commit from fix/message-item-reasoning-collapse-tooltip into master 2026-10-01 17:14:38 +00:00
rwachters commented 2026-10-01 17:14:07 +00:00 (Migrated from github.com)

Summary

Collapsing a message item now hides the assistant reasoning section along with the answer, and the reasoning section header toggle gained a tooltip.

  • MessageItem renders the reasoning section only when the message has reasoning and is not collapsed, so a collapsed message no longer leaves its reasoning standing next to a truncated answer.
  • The reasoning section's expansion state stays owned by the message list and is only read while rendering, so collapsing and re-expanding brings the section back in the state the user left it in.
  • The clickable reasoning header row is wrapped in PlainTooltipBox ("Show reasoning" / "Hide reasoning") with the same text as the click label, matching the tooltips used elsewhere in the chat area; the chevron stays decorative so a screen reader does not announce the action twice.

Notes

  • isCollapsible is unchanged and still decided by the answer length alone, so a long-reasoning/short-answer message offers no collapse affordance; widening it would change which messages get the affordance.
  • The tooltip strings are English literals, following the sibling collapse/expand tooltips in MessageItem; promoting them to string resources would be a separate localization change.

Testing

  • ./gradlew :app:desktopMainClasses
  • ./gradlew :app:desktopTest — 947 tests, 0 failures; the new MessageItemReasoningSectionTest cases cover "a collapsed message hides its reasoning section" and "expanding a collapsed message brings the reasoning section back in its previous state".
  • Only the Desktop target was compiled and tested; the change uses common Compose APIs only.
## Summary Collapsing a message item now hides the assistant reasoning section along with the answer, and the reasoning section header toggle gained a tooltip. - `MessageItem` renders the reasoning section only when the message has reasoning and is not collapsed, so a collapsed message no longer leaves its reasoning standing next to a truncated answer. - The reasoning section's expansion state stays owned by the message list and is only read while rendering, so collapsing and re-expanding brings the section back in the state the user left it in. - The clickable reasoning header row is wrapped in `PlainTooltipBox` ("Show reasoning" / "Hide reasoning") with the same text as the click label, matching the tooltips used elsewhere in the chat area; the chevron stays decorative so a screen reader does not announce the action twice. ## Notes - `isCollapsible` is unchanged and still decided by the answer length alone, so a long-reasoning/short-answer message offers no collapse affordance; widening it would change which messages get the affordance. - The tooltip strings are English literals, following the sibling collapse/expand tooltips in `MessageItem`; promoting them to string resources would be a separate localization change. ## Testing - `./gradlew :app:desktopMainClasses` - `./gradlew :app:desktopTest` — 947 tests, 0 failures; the new `MessageItemReasoningSectionTest` cases cover "a collapsed message hides its reasoning section" and "expanding a collapsed message brings the reasoning section back in its previous state". - Only the Desktop target was compiled and tested; the change uses common Compose APIs only.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Torvian.eu/chatbot!335
No description provided.