Skip to content

fix(message-list): re-pin the chat to the bottom when the content reflows - #251

Closed
vladimirfilosof wants to merge 1 commit into
mainfrom
CLOUDFRONT-62539-assistant-touch-scroll-jump
Closed

vladimirfilosof wants to merge 1 commit into
mainfrom
CLOUDFRONT-62539-assistant-touch-scroll-jump

Conversation

@vladimirfilosof

Copy link
Copy Markdown
Contributor

The stick-to-bottom ResizeObserver in useSmartScroll watched only the scroll container's own box. A re-layout that changes the content height without touching that box — the messages re-wrap, scrollHeight changes, the browser keeps scrollTop — left the list somewhere in the middle of the history with nothing to bring it back: scroll never fires, because scrollTop itself did not move. iOS Safari does exactly that while the system snapshots the page for a screenshot, so taking one from the bottom of a chat scrolled the feed back into the middle of the conversation and kept it there.

The container's children are now observed as well, since they span the whole scrollable content. Only the difference is (un)observed, so an already observed child does not re-deliver its size and re-pin the list on every DOM mutation. A user who scrolled up is unaffected — the existing userScrolledUp guard still gates every re-pin. Covered by unit tests: four of the six fail without the change.

Console: CLOUDFRONT-62539

🤖 Generated with Claude Code

…lows

The stick-to-bottom ResizeObserver watched only the scroll container's own
box. A re-layout that changes the content height without touching that box -
the messages re-wrap, `scrollHeight` changes, the browser keeps `scrollTop` -
left the list somewhere in the middle of the history with nothing to bring it
back: `scroll` never fires, because `scrollTop` itself did not move.

iOS Safari does exactly that while the system snapshots the page for a
screenshot, so taking one from the bottom of a chat scrolled the feed back
into the middle of the conversation and kept it there.

Observe the container's children as well, since they span the whole scrollable
content. Only the difference is (un)observed, so an already observed child does
not re-deliver its size and re-pin the list on every DOM mutation.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@gravity-ui

gravity-ui Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

🚀 Prerelease version published!

Install this PR version:

npm i --save-dev @gravity-ui/aikit@2.20.2-beta.de6d28351afafadd45e672108ecf935b8e837979.0

@gravity-ui-bot

Copy link
Copy Markdown

Preview is ready.

@gravity-ui

gravity-ui Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

🎭 Component Tests Report is ready.

@vladimirfilosof

Copy link
Copy Markdown
Contributor Author

Closing: the console-side ticket behind this fix was dropped from the sprint. The analysis and tests stay on the branch if we come back to it.

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.

2 participants