Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix: scrolling up during a running thread no longer snaps back to the bottom #5566

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/5566/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Scrolling up while a thread was streaming would yank you back to the bottom on the next update, on both web and mobile. You had no way to read earlier messages until the turn finished.

Now scrolling up holds your position, and scrolling back down to the bottom re-enables the stick-to-bottom behavior.

What was wrong:

  • Mobile had no notion of "the user scrolled away". LegendList's maintainScrollAtEnd re-pinned on pure geometry — anywhere within ~10% of a viewport of the bottom (or any thread shorter than the screen) snapped back on every stream chunk. Added a follow latch: a user drag (through its momentum) that leaves the bottom zone disables the maintain; returning to the bottom, sending, or switching threads re-arms it.
  • Web re-armed live-follow via LegendList's isNearEnd, which is true up to half a viewport above the bottom, so a modest scroll-up still counted as "following". The library's own maintain also ran independently of the app's follow state, the escape listeners attached in one animation frame with no retry, and keyboard scrolling never broke follow at all. Follow now re-arms only within a tight band at the true content bottom, gates the library maintain, and the opt-out listeners retry attachment, cover PageUp/Home/ArrowUp, and are direction/position-aware.
  • Turn completion could re-fire the sent message anchor after user navigation had cancelled it. That restarted send-time positioning and clamped the viewport to the bottom. Anchor positioning now ignores remeasurement unless the timeline is still in its explicit send-time anchoring phase.

Browser-verified in Chrome with a live 17-second GPT-5.6-Luna turn: the viewport remained exactly 1,100 px from the bottom through completion, then resumed normal follow after using Scroll to end.

Verified with typecheck, lint, and unit tests on both apps (1821 web, 615 mobile).


🤖 Latest fix generated with GPT-5.6-Sol in T3 Code using the Codex harness.


Note

Medium Risk Changes core chat scroll-follow behavior on web and mobile during streaming; localized to timeline UX but easy to regress edge cases (keyboard, touch, anchor sends).

Overview Fixes thread timelines yanking back to the bottom on every stream chunk after you scroll up to read earlier messages. Live follow is now an explicit latch that gates LegendList’s maintainScrollAtEnd instead of leaving the library to re-pin on its own geometry.

On mobile (ThreadFeed), follow turns off only during a real user drag/momentum that leaves the end band, and turns back on when you return to the bottom, switch threads, or anchor on send. On web (ChatView / MessagesTimeline), a liveFollowEnabled flag does the same gating; opt-out listeners retry if the list isn’t mounted yet, and wheel/touch/pointer/keyboard handlers only break follow when the viewport can actually move away from the live edge (avoiding spurious breaks while still pinned).

resolveTimelineIsAtEnd no longer treats LegendList’s broad isNearEnd as “at end”; it uses a 40px band at the true content bottom (with composer end inset), so modest scroll-up no longer re-arms follow. Send-time anchor positioning is also guarded so remeasures after a turn completes don’t restart anchoring once you’ve scrolled away.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f7fa3137265af2aaf2d80f7b4a0e869c4836e956. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix chat scroll so scrolling up during a running thread no longer snaps back to the bottom

  • Introduces a "live-follow latch" on both web (ChatView.tsx, MessagesTimeline.tsx) and mobile (ThreadFeed.tsx) that gates maintainScrollAtEnd on a flag rather than always keeping it enabled.
  • On web, follow is cancelled only by intentional user navigation away from the bottom: wheel-up, touch drag, scrollbar drag, or keyboard shortcuts (PageUp/Home/ArrowUp). Follow re-arms when the viewport returns within 40px of the content bottom.
  • On mobile, follow breaks only during an active user scroll session and re-arms on thread switches or when an anchor message is present.
  • resolveTimelineIsAtEnd in MessagesTimeline.logic.ts now uses geometry-based evaluation with a 40px (TIMELINE_FOLLOW_REARM_THRESHOLD_PX) re-arm band, replacing the previous isNearEnd check.
  • Behavioral Change: anchor remeasurement no longer repositions the scroll view after the user has scrolled away from the end.
Macroscope summarized f7fa313.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 40db45d0-14fa-49fc-9d07-d1e1c95ea738

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved f7fa313

      This is a well-scoped bug fix for scroll behavior that prevents the timeline from yanking users back to the bottom while they're reading history. Changes are self-contained to scroll handling logic across mobile and web, include unit tests for the threshold logic, and have clear explanatory comments.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. t3dotgg(GitHub profile, opens in a new tab) added labelsDO NOT MERGE

Sign in to join this conversation.