fix(webui): stop auto-scroll from fighting user scroll during streaming #124

Closed
mara wants to merge 0 commits from fix/ui-scroll-autoscroll into main
Collaborator

Problem

While the model is streaming, user scroll in the chat history is constantly fought by auto-scroll: the viewport keeps being yanked back (stale scroll anchor restore + tail snapping) instead of staying where the user scrolled.

Root cause

  1. The message-window scroll handler bailed out early while a window render was in flight (if (_messageWindowRenderPromise) return;) before updating direction/tail-follow state. During streaming, renders are nearly continuous, so _messageWindowFollowTail stayed pinned true and user scrolls were never registered.
  2. renderMessageWindow captured a scroll anchor at render start and restored it at render end, overwriting scroll positions the user changed mid-render.

Fix

  • Track user scroll direction/tail-follow state even while a window render is in flight.
  • Add a user-scroll-intent sequence counter; snapshot it at render start and skip stale anchor restore and tail snapping when the user scrolled during the render.

Verification

  • node --check webui/js/messages.js clean
  • pytest tests/test_webui_message_ordering_static.py tests/test_webui_message_window.py — 15 passed

Work done in git worktree symbolics-fix-ui-scroll-autoscroll from main.

## Problem While the model is streaming, user scroll in the chat history is constantly fought by auto-scroll: the viewport keeps being yanked back (stale scroll anchor restore + tail snapping) instead of staying where the user scrolled. ## Root cause 1. The message-window scroll handler bailed out early while a window render was in flight (`if (_messageWindowRenderPromise) return;`) before updating direction/tail-follow state. During streaming, renders are nearly continuous, so `_messageWindowFollowTail` stayed pinned `true` and user scrolls were never registered. 2. `renderMessageWindow` captured a scroll anchor at render start and restored it at render end, overwriting scroll positions the user changed mid-render. ## Fix - Track user scroll direction/tail-follow state even while a window render is in flight. - Add a user-scroll-intent sequence counter; snapshot it at render start and skip stale anchor restore and tail snapping when the user scrolled during the render. ## Verification - `node --check webui/js/messages.js` clean - `pytest tests/test_webui_message_ordering_static.py tests/test_webui_message_window.py` — 15 passed Work done in git worktree `symbolics-fix-ui-scroll-autoscroll` from `main`.
- track user scroll direction/tail-follow state even while a window render
  is in flight; the old early-return pinned follow-tail during streaming
- invalidate captured scroll anchors and tail snapping when the user
  scrolls while a render is running, so the viewport no longer snaps back
  to a stale position while the model is working
nsaspy closed this pull request 2026-09-08 18:38:53 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.