Skip to content

Chat autoscroll sometimes stops randomly after image content loads #2965

Description

@PEyacher

Describe the bug
Chat autoscroll can stop working when message content changes size after it renders, such as when images load. The scroll container may treat layout reflow as if the user manually scrolled away from the bottom, causing autoscrolling to be disabled without user input to do so.

To Reproduce
Steps to reproduce the behavior:

  1. Start a Chainlit app that streams messages containing images or other late-loading/resizing content.
  2. Open the chat UI.
  3. Send a message that triggers assistant output with images.
  4. Stay at the bottom of the conversation without manually scrolling upward.
  5. Wait for images/content to finish loading or resizing.
  6. See that autoscroll may stop and the scroll-to-bottom button appears even though the user did not intentionally scroll away.

Expected behavior
The chat should remain autoscrolled to the bottom while the user is already at the bottom, including when images load or message content changes height. Autoscroll should only be disabled when the user intentionally scrolls upward, and it should be re-enabled when the user returns to the bottom or clicks the scroll-to-bottom button.

Screenshots
Not available.

Desktop (please complete the following information):

  • OS: N/A
  • Browser: N/A
  • Version: N/A

Smartphone (please complete the following information):

  • Device: N/A
  • OS: N/A
  • Browser: N/A
  • Version: N/A

Additional context
This is most noticeable in conversations with image outputs. A sample app such as the one provided below can help reproduce the issue:

autoscroll_images.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfrontendPertains to the frontend.needs-triage

    Type

    No fields configured for Bug.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions