Skip to content

fix(chat): keep following when the transcript folds on its own - #2117

Merged
devswha merged 2 commits into
mainfrom
fix/chat-follow-layout-shift
Oct 28, 2026
Merged

devswha merged 2 commits into
mainfrom
fix/chat-follow-layout-shift

Conversation

@devswha

@devswha devswha commented Oct 28, 2026

Copy link
Copy Markdown
Owner

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

onScroll in src/components/ChatView.tsx treats an upward move with no reader input that lands past
the 48 px layout allowance as the reader leaving the end: it sets pagingAway and drops the list's
pending scroll to the end. LegendList (maintainVisibleContentPosition) and the browser make such
moves 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

  • Without reader input, an upward move during which the transcript got shorter (the last row moved
    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.
  • That pin-back is skipped while pagingAway is set and while a following reader's own click is laid
    out where they are (ChatTimeline manualLayout), as the timeline's own follow paths already do.
  • Over a transcript that did not shrink, nothing changes: a no-input scroll (a screen reader's, a
    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.
  • The new scroll baselines reset with the chat's other scroll state on a pane change or a history
    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

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.

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.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 29c152c and 483a57a.

Files selected for processing: 3
  • changelog.d/chat-follow-layout-shift.md
  • scripts/chat-virtual-browser-qa.ts
  • src/components/ChatView.tsx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

CodeRabbit did not review this head: it posted "rate limited" on the PR. Reviews that stand in for it on 483a57a:

  • Codex (gpt-6.1-sol, fast tier, xhigh) and the omo code reviewer both reviewed the first commit d8a278e and both blocked on the same finding. The 48 px layout allowance applied to each scroll event's move, so a no-input scroll (screen reader, Firefox scrollbar) stepping up in steps of 30 px or less was pinned back to the end past 48 px, a fix(chat): count a held scrollbar drag as scroll intent, and name the follow allowances #1902 regression.
  • 483a57a measures the allowance from the end again, skips the pin-back while manualLayout holds a click's layout, resets the new baselines on a pane change and a history replacement, and adds a QA case with two 30 px no-input steps. d8a278e fails that case and 483a57a passes it.
  • Codex re-reviewed the delta and approved: the finding is fixed and nothing new at MEDIUM or above. The omo reviewer re-reviewed the delta and approved, with one LOW left as is: while manualLayout holds, a view left past 48 px stays "following" without a jump button until the rows change, which is what manualLayout already means in ChatTimeline.

@devswha

devswha commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

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.

@devswha
devswha merged commit 8eddce5 into main Oct 28, 2026
11 checks passed
@devswha
devswha deleted the fix/chat-follow-layout-shift branch October 28, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat: virtual list layout adjustments cancel follow mode and strand scroll at random positions

1 participant