fix(desktop): the scroll-to-newest button goes once a closed card leaves nothing below
Dean: "If I expand a task or plan and it causes the scroll-to-bottom indicator to appear, but then I collapse and everything fits on the screen, the scroll-to-bottom button doesn't go away."
Cause
Conversation (renderer/ai-elements/conversation.tsx, behind the Transcript, Work, coding agent and subagent tabs and the Code feed) worked out whether the log was at the bottom on scroll events alone. Closing a fold re-renders only the fold, not Conversation. If the reader has scrolled back to the top, the content shrinks to fit without scrollTop changing, so the browser fires no scroll event and the stale "not at bottom" state keeps the button up. I reproduced it in headless Chrome: after the card collapsed, scrollHeight == clientHeight == 418 and the button was still shown. (When scrollTop does get clamped, Chrome fires a scroll event and the button already hid, which is why the bug only shows from the top.)
Fix
The existing per-render layout effect now also sets up one ResizeObserver on the log and on its direct children. When either resizes and nothing is left below, the log counts as being at its bottom again: the button hides and following resumes. A resize never turns following off, so content that grows on its own (a code block highlighting, say) leaves auto-follow as it was. ConversationScrollButton is the only scroll-to-newest button in the app, so this one change covers every surface.
Evidence
Headless Chrome, the real Conversation, Plan card and stylesheet. The task card is opened, the log scrolled back to the top, then the card is collapsed.
| Opened and scrolled to the top (button correctly shown) | Collapsed, before: button stuck | Collapsed, after: button gone |
|---|---|---|
![]() | ![]() | ![]() |
Tests
conversation.test.ts: "the way back to the newest line goes once a line closes and nothing is left below". It scrolls the log away from the bottom, shrinks the content to fit, and reports a relayout. It fails without the fix and passes with it../scripts/check.shexits 0.
CI could not verify the Mac UI: no CI job builds for the Mac, and ./scripts/verify.sh was not run because this is a Linux VM. LUKE-159 is the manual Mac pass.
š¤ Generated with Claude Code


