Repository navigation
fix(chat): keep following when the transcript folds on its own - #2117
Conversation
An upward scroll with no reader input that lands past the 48 px layout allowance stopped Chat from following the end. LegendList and the browser make such moves themselves when the transcript shrinks: a block above the view folding while the follow glide is under way, or a turn settling at the end with its work and a block above folding at once. The chat then stopped mid-transcript with New messages (#2042). Without reader input, an upward move during which the transcript got shorter (the last row moved up in it, or its height dropped) is now the layout's: following goes on, and a view left short of the end is pinned back. Over a transcript that did not shrink, a no-input move still leaves the end past 48 px (#1902). Reader input is unchanged. Fixes #2042
Review of the previous commit (Codex, omo): the 48 px layout allowance applied to each scroll event's move, so a screen reader or a Firefox scrollbar stepping up 30 px at a time over an unchanged transcript was pinned back to the end at 60 px, where main stops following (#1902). Without a shrink, the allowance is again the distance from the end. The pin-back also skips while a following reader's own click is laid out where they are (ChatTimeline manualLayout), as the timeline's own follow does, and the new scroll baselines reset with the chat's other scroll state on a pane change or a history replacement. The chat-virtual QA gains two 30 px no-input steps from the end: the previous commit fails it, this one passes.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 13 minutes. View limit details
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 |
|
CodeRabbit did not review this head: it posted "rate limited" on the PR. Reviews that stand in for it on 483a57a:
|
|
Merging 483a57a: omo-native-code-reviewer and Codex both pass this head, and the required checks are green. CodeRabbit did not review this head. The MEDIUM and LOW findings (fold plus append in one update, held scrollbar drag, an away-reader test) go to a follow-up issue. |
What it does for the user
Chat now keeps following new output to the end when part of the transcript folds on its own. Before
this, a turn settling at the end (its work folding together with a block above it), or a block above
the view folding while the view was still gliding to the end, could stop following mid-transcript and
show New messages, with no scroll by the reader.
Fixes #2042. Reported by @odfalik.
Cause
onScrollinsrc/components/ChatView.tsxtreats an upward move with no reader input that lands pastthe 48 px layout allowance as the reader leaving the end: it sets
pagingAwayand drops the list'spending scroll to the end. LegendList (
maintainVisibleContentPosition) and the browser make suchmoves themselves when the transcript shrinks. The list holds the rows on screen where they were, and
the browser keeps the view inside a shorter transcript. For one shrink both can move the view up, so
it lands hundreds of pixels from the end, or past the end of a follow glide that was still on its way.
Change
up in it, or its height dropped since the previous scroll event) now counts as the layout's: following
goes on, and a view left more than 48 px short of the end is put back there.
pagingAwayis set and while a following reader's own click is laidout where they are (ChatTimeline
manualLayout), as the timeline's own follow paths already do.Firefox scrollbar's) leaves the end once the view is past 48 px from it, however small its steps
(fix(chat): count a held scrollbar drag as scroll intent, and name the follow allowances #1902). Reader input (wheel, keys, touch, a scrollbar drag) is unchanged.
replacement.
Known trade-off: a no-input reader scroll that lands in the same scroll event as a fold is put back at
the end once; the next move leaves as before. During a turn that keeps folding this can happen more
than once. The page has no signal that tells such a scroll from the layout's own move in that event.
Design precedent: none of the coding-agent apps exposes how it tells its own re-layout from a reader's
scroll; this follows the rule #1734 set and #1902 kept, that only input that scrolls the transcript up
is the reader's intent.
How it was verified
scripts/chat-virtual-browser-qa.ts(realChatViewin Chromium, 1440 and 390 px, light and dark,already in CI's browser lane) gains:
fold-together: at the end, the last row and a row above fold in one layout (a turn settling).Following goes on to the end and the next output is followed. Fails on main
("fold-together: the next output is followed"), passes here.
fold-above/grow-above: a row above folds or grows while the view glides to the end after thelast row grew. These pass here; on main they fail only when the fold lands in the same frame as the
glide, so they do not fail on every main run.
wheel-up: a real upward wheel (page.mouse.wheel) still stops following ("Jump to latest", thenNew messages with the reader left away from the end).
the first commit's regression found in review.
scripts/chat-local-send-follow-demo-regression.ts(fix(chat): follow your own accepted send back to the end unless you navigate #1831),scripts/chat-gjc-streaming-browser-qa.ts(Chat: GJC tool streaming moves the viewport and loses expanded tool details #1388/fix(chat): keep a tool you opened in place while GJC streams, and through its rewrites #1937) and
scripts/composer-fit-demo-regression.ts(fix(chat): keep following the end while a growing draft shrinks the transcript #1431): pass on the final commit.bun run check fast: green on the final commit.one finding: the 48 px allowance applied per scroll event, so small no-input steps were pinned back
(a fix(chat): count a held scrollbar drag as scroll intent, and name the follow allowances #1902 regression). The second commit measures it from the end again. The omo reviewer's other
findings were fixed: the
manualLayoutguard and the baseline resets. Codex re-reviewed the fix:APPROVE.
Not reproduced on a real Firefox or with a screen reader. Once, during QA, a real wheel landing early in
a glide did not stop following; it did not reproduce in six later runs (three on main, three here) and
this change does not touch moves made with reader input.