Skip to content

fix(mobile): phone chat page stops following only when you touch, wheel or key-scroll it - #29072

Closed
brennanb2025 wants to merge 8 commits into
brennanb2025/mobile-page-hold-reading-messagefrom
brennanb2025/mobile-page-follow-reader-input
Closed

brennanb2025 wants to merge 8 commits into
brennanb2025/mobile-page-hold-reading-messagefrom
brennanb2025/mobile-page-follow-reader-input

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​60 $\color{#cf222e}{\Huge{\mathbf{−}}}$​45 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​184 $\color{#cf222e}{\Huge{\mathbf{−}}}$​60 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​124

ELI5

On the phone's chat page (the over-the-air version of the phone app, which runs as a web page), Orca keeps you at the newest line while an agent writes, and stops doing that when you scroll up to read. It decided "you scrolled up" by watching which way the list's scroll position moved. But Orca itself, and the page laying out rows, move that position too, so Orca sometimes stopped following when you hadn't touched anything, or jumped you back while you were reading. Now Orca stops following only when you actually touch, wheel or key-scroll the list in a way that can take you away from the newest line, and starts again when you're back at the end.

What Changed

The problem. On the page, the web list Orca uses doesn't follow new output for us, so Orca does it by hand: it pins the list to the end as output arrives, and stops pinning when the reader scrolls away. "The reader scrolled away" was read from the direction the scroll position moved. Rows rendering, the oldest row being dropped at the 2,000-message limit, rows being re-measured, Orca's own pins and Orca's "keep your place" correction all move the scroll position too. Every page bug found in the follow-ups to #28413 was one of those writers misread by that check: following stopped on the first new message at the 2,000-message limit; "Scroll to latest" landed short and stopped following; a small nudge stopped following with no "Scroll to latest" button while output piled up below.

Real iPhone event logs from QA showed two more facts: iOS sends one touch-move at most before it takes over the pan, then a lift, then about 2 seconds of momentum scroll events after the finger is gone; and it never sent a touch-cancel.

Before → after, on the phone page:

What you do Before (main, and #29043/#29065) After
Nudge the list up a little, let go Following stops, but no "Scroll to latest" button appears while new output lands below (the view looks frozen) Following stops where you let go; the button appears once new output is more than about a thumb's height (80 pt) below
Rest a thumb on the list while output streams The view keeps pinning to the newest line under your thumb Nothing moves under your thumb; the button appears if output piles up below; when you lift without having scrolled, it catches up to the newest line and keeps following
Tap a link or a tool row while following No change Following pauses for the tap and comes back on lift. If more than 80 pt of output lands while the finger is held down, the button shows until the lift
Swipe on a chat that still fits the screen (a new chat's first reply) Keeps following Keeps following: on lift it catches up to the newest line
Pan slowly toward the end while output lands Keeps following Keeps following: on lift it catches up to the newest line
Scroll or fling up Following stops Following stops, from the moment your finger lands; iOS's momentum after the lift never pulls you back
Scroll or fling back down to the end Following resumed as soon as you were moving down within 80 pt of the end, even mid-momentum or mid-bounce Following resumes when the view rests at the end (within 1 pt, not while iOS is bouncing it)
Mouse wheel up / Page Up, Home, Arrow Up Following stops (read from the movement) Following stops (read from the wheel or key itself)
New output while following, at the 2,000-message limit The first new message drops the oldest row; the "keep your place" correction reads as you scrolling up, and following stops Following continues
"Scroll to latest" at ~2,000 messages after a burst Could land short of the end and stop following, with the button still showing Lands at the end and keeps following while the list finishes measuring
VoiceOver moves through messages, or another scroll that sends the page no touch, wheel or key (see Known limitation) Following stops Following continues, so the next streamed output moves the view back to the newest line
Send Jumps to the newest message and follows Same

Native app builds are unchanged: they keep their own drag and momentum events.

Mechanism.

  • use-mobile-native-chat-tail-follow.ts: on the page, scroll events no longer decide that the reader left. Following turns off on the list's touch-start, an upward wheel, or Arrow Up / Page Up / Home (the last two only when the view can move up). It turns back on when a scroll event shows the view resting at the end with no finger on the list, on an explicit jump (send, "Scroll to latest"), or when the last finger lifts.
  • The lift re-derives following. The touch start only pauses following, so nothing pins under a finger. At the lift, following is worked out again from what the touch could have done. Only a pan down the screen, over a list taller than the screen, can take the view away from the end. Any other touch that started while following gives following back and catches up with one pin: a tap, a resting thumb, a two-finger pinch, or a pan toward the end. So does any touch on content that fits the screen. A reader who had already scrolled up resumes only if a pan up the screen leaves the view resting at the end. A pan down never resumes on lift, because its first scroll event can trail the lift. If the lift comes while iOS is still bouncing the list past an end, nothing is written; the scroll event where the bounce settles resumes following at the end.
  • The touch start is the page's stand-in for a native list's "drag began" event: it arrives before iOS takes the pan, so no pin can land under a finger or in the momentum after it.
  • "More than 80 pt from the end" is now re-checked when the content grows, not only on scroll events, so the button appears while a parked view's output lands below (this was the nudge bug).
  • The hook now renders only the "Scroll to latest" decision, not the following flag itself, so a tap while following doesn't re-render the whole chat twice.
  • MobileNativeChatView.tsx: spreads the hook's list-input props (the native drag/momentum handlers move there, unchanged).

Why

The bug class this removes. On the page, "the reader scrolled away" was inferred from which way the scroll position moved, but layout and Orca's own writes move it too. Reading intent from input instead of from the position removes every writer from the question at once, instead of teaching the check to recognise each writer (#28807 tried that over six review rounds: a settle timer, a set of touch ids, a cancel state, a gesture quiet window; each piece had its own hole).

A second bug class, found in review and removed here: a pause that nothing re-derives. The first version of this PR turned following off at the touch start and gave it back at the lift only for a touch whose finger barely moved. When the finger moved but the list couldn't move away from the end (a chat that still fits the screen, or a pan toward the end), no scroll event came to turn following back on. The reply then grew below the screen unfollowed, with no button for the first 80 pt. The lift now works following out from whether the gesture could have taken the view away from the end, so a paused following always ends in a decision. The common pattern has the same rule: a gesture that can't move the view away from the end never stops following.

How "reader input" works on a page where iOS owns the pan. A native list reports drag-begin, drag-end and momentum-end. The page gets none of them. The touch start replaces drag-begin. The lift replaces drag-end. Momentum needs no end event: after a pan away from the end following is already off, so momentum scroll events can only turn it back on, and only by resting at the end.

Alternatives considered.

  • Stop on a touch-move away from the end (one common web design): iOS sends one touch-move at most before it takes the pan, so a small nudge was never seen and the next pin snapped the reader back, then wrote again during momentum.
  • A short input window after each touch or wheel (another common design): needs a timer, and still pins under a resting thumb.
  • Keep reading direction, but tag Orca's own writes: every new writer (the browser, RN Web's re-measuring) needs its own tag. That is the guard-per-writer approach this PR replaces.

Differences from the common pattern. The common pattern stops following on the reader's own input (a native drag, or wheel / touch / key events on the web), only when that input can move the view away from the end. It resumes at the end, re-arms on send, and shows a jump-to-end control whenever it isn't following.

  • Intended: the touch start, not a drag-begin event, pauses following, because the page has no drag events. The lift always decides it again; if the lift is lost, the next touch, reaching the end, or any jump decides it.
  • Intended: a touch that can't take the view from the end hands following back on lift and catches up, so a resting thumb never has the view pinned under it. The common pattern keeps pinning under a still finger; on the page, QA showed that moves the text under the reader.
  • Intended: resume needs the view to rest within 1 pt of the end and not be in iOS's bounce (the common pattern uses a few points to tens of points). 1 pt is the page's existing slop, and writing while iOS bounces the list is what froze it in fix(mobile): phone page loads older messages only from the Load earlier button, so the chat no longer freezes at the top #29043.
  • Intended: the "Scroll to latest" button shows when not following and more than 80 pt from the end (the common pattern: whenever not following). A tap briefly pauses following, so "whenever not following" would flash the button on every tap; 80 pt is the existing threshold.
  • Intended: only touch devices' touches and wheel/keys count; dragging a desktop browser's scrollbar isn't input here. The page runs on phones.
  • Intended: if the row under a resting thumb is removed mid-touch (for example the streaming reply is replaced when the turn ends), the browser never tells React the finger lifted. Following then stays off; "Scroll to latest" appears if output lands more than 80 pt below, and the next touch, scrolling to the end, a send or the button resumes it. No touch-id tracking or timers were added to catch it.
  • Intended: the "keep your place" correction from fix(mobile): phone page keeps the message you were reading when older messages load #29065 still runs while following. Its write can no longer turn following off, and the next pin goes to the end.

Known limitation (temporary). Scrolling that sends the page no touch, wheel or key event no longer stops following on the page: VoiceOver moving its focus through messages or its three-finger scroll, and iOS scrolling the list while you extend a text selection. While output streams, the next chunk moves the view back to the newest line. This is the same as the native app and as the page before #28413, and it differs from 1.4.226, where any upward movement stopped following. It isn't fixed here because "the position moved away from the end with no input" is exactly the check this PR removes: on the page, the cap trim, re-measuring, clamps and Orca's own writes also move the position with no input. Telling them apart needs its own design and device checks. Follow-up: treat accessibility and text-selection scrolling as the reader's input on the page (ticket to be filed by the coordinator).

Split out of this PR.

Stacked on #29065 (which is stacked on #29043). Supersedes the following half of #28807.

Linked Issue

Follow-up to #28413; tracked with #28807.

Visual Proof

Pending: iOS simulator and phone-viewport browser QA runs on this branch.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • MobileNativeChatView.test.ts: one whole-flow test of the page. A swipe on a chat that fits the screen keeps following; a layout move doesn't stop following; a resting thumb isn't pinned under and catches up on lift; a nudge plus iOS momentum doesn't re-pin; reaching the end resumes; a wheel up stops. Replaces the old "a move up is the reader" test.

  • Lint, typecheck and tests run in CI (nothing heavy runs on the author's machine).

Notes

Mobile only; no wire, settings or saved-data changes. Native builds unchanged.

On the phone page, "the reader scrolled away" was read from the direction
scrollTop moved. Rows rendering, trims, re-measuring, pins and the place-hold
move scrollTop too, so each of them could be misread as the reader.

Following now stops on the reader's touch, an upward wheel or a scroll key,
and resumes when the view rests at the end. A touch that never pans hands
following back on lift, so a resting thumb never has the view pinned under
it and momentum after a pan never re-pins. Switching chats opens at the
newest message.
…ps following

Following is re-derived when the finger lifts: only a pan down the screen over
a list that can scroll leaves the end, so a swipe on a chat that still fits the
screen, or a pan toward the end while output lands, gives following back and
catches up. No write lands in iOS's bounce after a pan.
Opening another chat at its newest message is separate from how the page
decides the reader stopped following, so it lands on its own.
… on this one

The hold for the oldest message trimmed at the 2,000 cap is independent of how
the page decides the reader stopped following; it lands on its own on top.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing: following on the phone chat page is being reworked in #29271 (one windowed list); this change will be redone on top of it if still needed. Branch kept.

@brennanb2025
brennanb2025 deleted the brennanb2025/mobile-page-follow-reader-input branch October 19, 2026 20:54
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.

1 participant