Skip to content

fix(ui): scroll chat to bottom on initial load - #274

Merged
steipete merged 3 commits into
openclaw:mainfrom
kiranjd:fix/chat-scroll-to-bottom
Jan 6, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
kiranjd:fix/chat-scroll-to-bottom

Conversation

@kiranjd

@kiranjd kiranjd commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix chat view starting at top (oldest messages) instead of bottom (latest messages)
  • Chat now behaves like WhatsApp - opens showing the most recent messages

Problem

When opening the Chat view in the dashboard, users had to manually scroll down to see the latest messages. This was poor UX since chat interfaces conventionally show the most recent messages first.

Root causes:

  1. scheduleChatScroll() was called without the force flag in refreshActiveTab()
  2. The scroll logic was targeting .chat-thread element which has overflow: visible - it doesn't scroll, the window does

Solution

  • Pass force flag (!chatHasAutoScrolled) when loading chat tab to force initial scroll
  • Wait for Lit updateComplete before scrolling to ensure DOM is ready
  • Scroll the window instead of the .chat-thread container
  • Use behavior: 'instant' for immediate scroll without animation
  • Add retry after 150ms to handle late-loading content

Test plan

  • Open dashboard, navigate to Chat - should start at bottom showing latest messages
  • Refresh page while on Chat - should scroll to bottom
  • Switch between tabs and back to Chat - should scroll to bottom
  • Send a message - should stay at bottom as new messages arrive

🤖 Generated with Claude Code

The chat view was starting at the top showing oldest messages instead of
scrolling to the bottom to show the latest messages (like WhatsApp).

Root causes:
1. scheduleChatScroll() was called without force flag in refreshActiveTab()
2. The scroll was targeting .chat-thread element which has overflow:visible
   and doesn't actually scroll - the window scrolls instead

Fixes:
- Pass force flag (!chatHasAutoScrolled) when loading chat tab
- Wait for Lit updateComplete before scrolling to ensure DOM is ready
- Scroll the window instead of the .chat-thread container
- Use behavior: 'instant' for immediate scroll without animation

@thewilloftheshadow thewilloftheshadow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR notes “.chat-thread has overflow: visible so the window scrolls,” but that isn’t true in constrained layouts/tests where .chat-thread is the scroll container (overflow auto/max-height). Switching to window breaks auto-scroll there. Please update the logic to scroll the actual scroll container (use .chat-thread when it’s scrollable, otherwise fall back to window) so both layouts work.

@steipete

steipete commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

I just fixed up the bits.

@steipete
steipete merged commit d14505f into openclaw:main Jan 6, 2026
@steipete

steipete commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Merged — thanks @kiranjd!\n\nTests: pnpm lint, pnpm build, pnpm test, pnpm docs:build

dgarson added a commit to dgarson/clawdbot that referenced this pull request Feb 9, 2026
dgarson added a commit to dgarson/clawdbot that referenced this pull request Feb 9, 2026
dgarson added a commit to dgarson/clawdbot that referenced this pull request Feb 9, 2026
dgarson added a commit to dgarson/clawdbot that referenced this pull request Feb 9, 2026
* Revert "Revert "Web: refine conversation loading and demo delays (openclaw#274)" (openclaw#275)"

This reverts commit 13a8f9e.

* feat: add comprehensive configurable debug/trace logging for block/stream replies
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
fix(ui): scroll chat to bottom on initial load
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
fix(ui): scroll chat to bottom on initial load
muneebhashone pushed a commit to muneebhashone/clawdbot that referenced this pull request Aug 25, 2026
fix(ui): scroll chat to bottom on initial load
zeekay pushed a commit to Dream-AI-4444/bot that referenced this pull request Sep 11, 2026
fix(ui): scroll chat to bottom on initial load
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
fix(ui): scroll chat to bottom on initial load
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.

3 participants