fix(desktop): honor upward wheel scroll in long threads - #37831
Closed
ferminquant wants to merge 1 commit into
Closed
fix(desktop): honor upward wheel scroll in long threads#37831ferminquant wants to merge 1 commit into
ferminquant wants to merge 1 commit into
Conversation
ferminquant
marked this pull request as draft
June 3, 2026 03:23
ferminquant
marked this pull request as ready for review
June 3, 2026 03:32
ferminquant
marked this pull request as draft
June 3, 2026 03:37
ferminquant
marked this pull request as ready for review
June 3, 2026 03:40
Contributor
Author
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.
Summary
Root Cause
pinToBottom()incrementsprogrammaticScrollPendingRefbefore writingel.scrollTopso the resulting scroll event is treated as programmatic, not user-driven. If the browser is already clamped at the bottom, the expected programmatic scroll event may not arrive, leaving the pending count stale.The next real upward wheel scroll could then be consumed as if it were programmatic, re-arm sticky-bottom behavior, and let the next resize/content-growth pin pull the viewport back down.
Test Plan
npm run test:ui -- src/components/assistant-ui/streaming.test.tsx -t "honors the first upward wheel scroll"AssertionError: expected 1200 to be 420npm run test:ui -- src/components/assistant-ui/streaming.test.tsx -t "honors the first upward wheel scroll"npm run test:ui -- src/components/assistant-ui/streaming.test.tsxnpm run type-checknpx eslint src/components/assistant-ui/thread-virtualizer.tsx src/components/assistant-ui/streaming.test.tsxthread-virtualizer.tsx.git diff --checknpm run test:ui.test.cjsfiles reported by Vitest as no-suite files, plussrc/components/pane-shell/pane-shell.test.tsx/uses widthOverride from the store when set.Manual / Real Behavior Proof
420, content grows, and the viewport must remain at420instead of being pinned to1200.--remote-debugging-port=9222 --ozone-platform=headless --disable-gpu --no-sandboxusing temporaryHERMES_HOMEandHERMES_DESKTOP_USER_DATA_DIR.http://127.0.0.1:5174/#/, titleHermes, composer present, thread viewport present, andwindow.__PERF_DRIVE__available.Input.dispatchMouseEventwheel event over the viewport, and sampled real DOMscrollTop/scrollHeight/clientHeightevents.scrollTop=1735,scrollHeight=2463,clientHeight=728,distFromBottom=0; after the upward wheel eventscrollTop=1354,distFromBottom=478; after continued stream growth finalscrollTop=1354,scrollHeight=3613,distFromBottom=1531. The viewport moved up on the first wheel and was not pinned back to bottom while content continued growing./tmp/desktop-wheel-proof.json; summary output reportedpassed: true.Security / Privacy Impact
Risks
npm run test:uiis not clean on current main, so broad-suite proof is limited to baseline comparison rather than a green full suite.Scope Boundaries
programmaticScrollPendingRefstate.programmaticScrollPendingRefroot-cause path is addressed, but this PR does not claim to fix the separateflushPendingViewStateflicker path discussed there.upstream/mainafter explicit user request.Linked Issue
Fixes #37527
Related to #37549
Commits
b28dd3417154ea3b03