Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 2b8b6c1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…st-jump reflow Jump to the end of a long flow-layout list, then scroll to 0 on the next frame. The scroll to the top is currently undone: scrollTop ends near the bottom (~48500 in the default fixture) and item 0 is not rendered. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013imjkuZ1miKJ7HzHWg6Ku2 Signed-off-by: Aleksandr Tarutin <atarutin@orionsbelt.net>
…render range After a jump into unmeasured rows, the flow layout keeps its anchor until the layout is stable. A new scroll position that lands in that window was measured against the stale anchor; _getItems computed an anchorErr, added it to _scrollError, and the virtualizer scrolled back to the anchor. Choose a new anchor when the old one is outside [lower, upper]. The change is the anchor-validation hunk from Gray Norton's lit#5279. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013imjkuZ1miKJ7HzHWg6Ku2 Signed-off-by: Aleksandr Tarutin <atarutin@orionsbelt.net>
atarutin
force-pushed
the
fix/virtualizer-stale-anchor
branch
from
October 22, 2026 23:39
382b870 to
2b8b6c1
Compare
This branch has not been deployed
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 #5418
Bug
After a jump into unmeasured rows (for example,
scrollTop = scrollHeighton a long flow-layout list), the flow layout keeps its anchor (the last item) until the layout is stable. If the user scrolls somewhere else during that window,_getItemsmeasures the new position against the stale anchor. It computesanchorErr, adds it to_scrollError, and_correctScrollErrorscrolls the viewport back to the anchor. A scroll to the top made one frame after a jump to the end leaves the list at the bottom.Fix
Re-pick the anchor when
_anchorPosis outside[lower, upper]. This is the anchor-validation hunk from @graynorton's #5279, taken by itself so it can land without the rest of that stack (#5249). Only the code comment differs, because the freeze/unfreeze API that #5279's comment refers to isn't onmain.Test
src/test/scenarios/scroll-jump-anchor.test.tsjumps to the end, scrolls to 0 on the next frame, and asserts thatscrollTop < 50and that item 0 is rendered. It covers<lit-virtualizer>andvirtualize()withscroller, and<lit-virtualizer>with window scrolling.scrollTopis 48550, 48550 and 48358. They failed the same way on 4 runs.CI=true, and 117 passed without it, including theskipInCIscrolling tests.tsc --target ES5, eslint and prettier are clean.The test is a separate commit, so it can be checked out before the fix.
🤖 Generated with Claude Code
https://claude.ai/code/session_013imjkuZ1miKJ7HzHWg6Ku2