fix: reliable auto-scroll with scroll-to-bottom button#150
Merged
devartifex merged 1 commit intodevartifex:masterfrom Apr 14, 2026
Merged
fix: reliable auto-scroll with scroll-to-bottom button#150devartifex merged 1 commit intodevartifex:masterfrom
devartifex merged 1 commit intodevartifex:masterfrom
Conversation
Replace CSS scroll-behavior: smooth with explicit scroll tracking. The old approach used isNearBottom() position checks that broke when smooth scroll animations hadn't completed, permanently disengaging auto-follow with no way to re-engage. Changes: - Track sticky state with explicit stickToBottom flag instead of position-only checks - Use Svelte tick() + instant scroll (no animation race conditions) - Add scroll-to-bottom arrow button when user scrolls up - Re-engage auto-follow automatically when user sends a message - Use untrack() to prevent stickToBottom from triggering the scroll effect as a dependency - Wrap messages in container div for button positioning Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
devartifex
approved these changes
Apr 14, 2026
Owner
devartifex
left a comment
There was a problem hiding this comment.
LGTM — Excellent fix for the auto-scroll race condition. The explicit stickToBottom flag with untrack() correctly decouples the scroll state from reactive tracking. Using tick() + instant scroll instead of CSS smooth scroll eliminates the animation race window. The scroll-to-bottom button has proper aria-label for accessibility. Re-engaging auto-follow on isWaiting is a nice UX touch. All 399 unit tests pass (check failure is a pre-existing coverage threshold issue).
devartifex
pushed a commit
that referenced
this pull request
Apr 14, 2026
Replace CSS scroll-behavior: smooth with explicit scroll tracking. The old approach used isNearBottom() position checks that broke when smooth scroll animations hadn't completed, permanently disengaging auto-follow with no way to re-engage. Changes: - Track sticky state with explicit stickToBottom flag instead of position-only checks - Use Svelte tick() + instant scroll (no animation race conditions) - Add scroll-to-bottom arrow button when user scrolls up - Re-engage auto-follow automatically when user sends a message - Use untrack() to prevent stickToBottom from triggering the scroll effect as a dependency - Wrap messages in container div for button positioning Co-authored-by: Dmitry Butko <dmitrybutko@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes chat auto-scroll permanently disengaging when the user scrolls up, with no way to re-engage.
Root cause: CSS
scroll-behavior: smoothcaused a race condition - smooth scroll animations hadn't completed when the next position check fired, soisNearBottom()returned false mid-animation and auto-follow permanently disengaged.Changes:
stickToBottomflagtick()+ instant scroll instead of CSS smooth scroll (no animation race)untrack()to prevent the sticky flag from being a reactive dependency in the scroll effect