fix(ui): prevent mobile scroll flickering during AI streaming#16625
Open
fkxxyz wants to merge 1 commit intoanomalyco:devfrom
Open
fix(ui): prevent mobile scroll flickering during AI streaming#16625fkxxyz wants to merge 1 commit intoanomalyco:devfrom
fkxxyz wants to merge 1 commit intoanomalyco:devfrom
Conversation
bf3b28e to
dbabb75
Compare
This was referenced Mar 10, 2026
- Respect userScrolled state in smoothScrollToBottom() instead of forcibly resetting it - Add handleTouchStart() to detect mobile touch interactions - Register touchstart event listener for mobile devices Fixes anomalyco#16622
dbabb75 to
0cf43b7
Compare
This was referenced Mar 15, 2026
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.
Issue for this PR
Closes #16622
Type of change
What does this PR do?
This PR adds mobile touch event support to prevent infinite scroll flickering during AI streaming responses.
Problem:
When users try to scroll up on mobile devices while AI is generating responses, the page flickers and jumps back to the bottom repeatedly, making it impossible to read previous messages.
Root Cause:
Mobile touch events were not being captured - only desktop
wheelevents were handled. This caused the auto-scroll system to not detect when mobile users were manually scrolling.Note on v1.2.24:
The core fix for respecting
userScrolledstate (if (!force && store.userScrolled) returnat line 87) was already included in v1.2.24's refactored scroll logic. This PR complements that fix by adding mobile touch event detection.Changes Made:
Added
handleTouchStart()function to detect mobile touch interactions:userScrolledflag when user touches the screenonUserInteractedcallbackRegistered
touchstartevent listener for mobile devices:{ passive: true }for performanceWhy This Works:
handleTouchStartimmediately marks the interactionscrollToBottom()logic (line 87) checksuserScrolledand returns earlywheelevents)Files Changed:
packages/ui/src/hooks/create-auto-scroll.tsx(10 lines: 1 function + event listeners)How did you verify your code works?
Screenshots / recordings
Mobile testing shows smooth scrolling without flickering during AI streaming. The fix has been verified on both iOS and Android devices.
Checklist