Skip to content

WebChat: auto-scroll overrides user scroll position when reading history #7225

@marcomarandiz

Description

@marcomarandiz

Bug

When a user scrolls up in the WebChat UI to read older messages, new incoming messages (including streaming chunks) force-scroll them back to the bottom. This makes it impossible to read conversation history while the agent is responding.

Root Causes

  1. Threshold too tightdistanceFromBottom < 200 means a single long message puts you "near bottom" again
  2. refreshChat() force-scrolls — calls scheduleChatScroll(host, true) which ignores user scroll position
  3. Streaming chunks retrigger scroll — rapid scheduleChatScroll calls during streaming constantly reset position

Expected Behavior

  • If the user has deliberately scrolled up (more than ~450px from bottom), new messages should NOT auto-scroll
  • A "new messages below" indicator should appear instead
  • Auto-scroll should only be forced on initial page load, not during active use
  • When user scrolls back to bottom, normal auto-scroll behavior resumes

Proposed Fix

  • Increase near-bottom threshold from 200px to 450px (extracted to named constant)
  • Make force=true only effective on initial load (!chatHasAutoScrolled)
  • Add chatNewMessagesBelow flag for future UI indicator
  • Remove force-scroll from refreshChat()

Environment

  • OpenClaw 2026.2.1
  • macOS WebChat (Brave app mode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions