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:
- Start a Chainlit app that streams messages containing images or other late-loading/resizing content.
- Open the chat UI.
- Send a message that triggers assistant output with images.
- Stay at the bottom of the conversation without manually scrolling upward.
- Wait for images/content to finish loading or resizing.
- 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
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:
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):
Smartphone (please complete the following information):
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