fix(desktop): prevent scroll rubber-banding from virtualizer measurement adjustments - #43914
Closed
Colinchiu007 wants to merge 2 commits into
Closed
fix(desktop): prevent scroll rubber-banding from virtualizer measurement adjustments#43914Colinchiu007 wants to merge 2 commits into
Colinchiu007 wants to merge 2 commits into
Conversation
…ent adjustments When the user is reading mid-conversation (not parked at bottom), small virtualizer scroll adjustments (≤ 50px) from async rendering (Shiki highlighting, image loading) create a feedback loop: measure → adjust → re-measure → re-adjust → visible content jumping. The existing AT_BOTTOM_THRESHOLD guard only covered the 'parked at bottom' case. This adds MEASUREMENT_NOISE_THRESHOLD=50 for the mid-conversation case: block small measurement-correction scrolls and let the browser's native CSS overflow-anchor handle real content growth without feedback loops. Fixes the core complaint: '对话内容总是自动跳到上下一段距离, 不是固定在我阅读的位置'.
Contributor
|
Thanks for identifying the scroll-jitter failure mode. This is now superseded by current
Closing as implemented on main via |
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.
Problem
对话内容总是自动跳到上下一段距离,不是固定在我阅读的位置。
Root Cause: The conversation uses
@tanstack/react-virtualvirtual list. After messages render, async operations (Shiki syntax highlighting with 120ms delay, image loading) change item heights. The virtualizer adjusts scroll offset to "preserve viewport position" — but this creates a feedback loop: measure → adjust → re-measure → re-adjust, producing visible rubber-banding / content jumping.The existing
AT_BOTTOM_THRESHOLDguard (added previously) only covered the "parked at bottom" case. When the user is reading mid-conversation, there was no protection.Fix
New constant
MEASUREMENT_NOISE_THRESHOLD = 50— any virtualizer scroll adjustment ≤ 50px is treated as measurement noise, not user intent.Updated
scrollToFnwith two guard cases:The browser's native CSS
overflow-anchor: autohandles real content growth/shrink without feedback loops.Testing
This is a UX fix for intermittent scroll jitter. Best verified by:
Related
Closes the "对话内容跳动" issue.