Skip to content

[Control UI] Chat auto-scroll overrides user scroll during streaming #37500

@liyuefan0214

Description

@liyuefan0214

Problem

When the assistant is streaming a response in the Control UI chat, the page continuously auto-scrolls to the bottom. If the user scrolls up to review previous messages during streaming, they get pulled back down almost immediately.

This makes it impossible to reference earlier messages while the assistant is still generating output.

Expected Behavior

Once the user manually scrolls up during streaming, auto-scroll should pause until the user scrolls back to the bottom (or clicks a "scroll to bottom" button).

Current Behavior

The Yn (scrollToBottom) function does check chatUserNearBottom, but during streaming the content height keeps growing, which appears to re-trigger scroll logic repeatedly. The 450px (zi) threshold for "near bottom" detection also seems too generous — a small upward scroll still counts as "near bottom" and gets overridden.

Relevant code in dist/control-ui/assets/index-Qb3PJV7U.js:

const zi = 450; // threshold

function sg(e, t) {
  const n = t.currentTarget;
  const s = n.scrollHeight - n.scrollTop - n.clientHeight;
  e.chatUserNearBottom = s < zi;
  e.chatUserNearBottom && (e.chatNewMessagesBelow = false);
}

Suggested Fix

  1. Lock auto-scroll off when user scrolls up during streaming — once the user initiates an upward scroll during active streaming, set a flag to suppress auto-scroll until streaming ends or the user scrolls back to the bottom.
  2. Reduce the threshold — 450px is quite large; something like 100-150px would better match user intent.
  3. Do not re-trigger scroll on streaming content growth — only auto-scroll when a new message chunk arrives AND the user has not scrolled away.

Environment

  • OpenClaw Control UI (webchat)
  • macOS / Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions