restoreAnchorForShift sets the scroll source to RestoreSnapshot. A later scripted scrollTop assignment or native scrollbar drag can be treated as ProgrammaticScroll, so the rendered window does not move and the viewport shows only spacer.
This is one of the pull requests behind Six merged PRs in 72 hours . The series looks at the failure, the fix and the review evidence, one merge at a time.
The change: +132 / -14 across 5 files. PR 70630 .
The bug
That is a state-machine bug, not a layout bug. The DOM has the items, the virtualizer has a range, but the source of the scroll event is classified incorrectly, so the virtualizer ignores the correction that should bring the first rows back.
The reported case was a filtered 1,000-row list. Clearing the filter and clicking Back to top had to render the first rows, but the viewport could stay on empty space.
Why it mattered
Virtualization is a correctness feature: it decides which rows exist in the DOM. When the scroll source is wrong, the page can look blank even though the data is present. Users read that as data loss or a frozen UI.
The fix
Keep restore-related observer callbacks classified as RestoreSnapshot until a later scroll or input changes the source. Ignore a restore scroll only when the scroll position actually changes, so a no-op correction does not consume the next scroll. The count-growth jump described in #70540 stays outside this change.
The evidence
The PR adds VirtualizationFilterGrowth for the reported filtered list and an E2E test where clearing the filter and clicking Back to top must render the first rows. Validation covered JavaScript debug and production builds, a focused TypeScript check, unit tests and 44 targeted Chrome E2E cases across Server and WebAssembly.
What I would repeat
When a UI bug depends on event ordering, write the user action as the test. “Call the method” is not enough. The failing path here is a sequence: filter, clear, click Back to top, assert the first rows exist.
Sources
Pull request
Series hub: six merged PRs in 72 hours
More engineering notes
If this was useful, connect with me on LinkedIn ; I write about the bugs behind merged pull requests and the evidence that gets them accepted.
Originally published at josuebarros.com.
Top comments (0)