Skip to content

[release/11.0-preview7] Fix Virtualize scroll jump from native/JS anchoring double-compensation - #67973

Merged
lewing merged 1 commit into
dotnet:release/11.0-preview7from
dariatiurina:backport/pr-67934-to-release-11.0-preview7
Jul 23, 2026
Merged

lewing merged 1 commit into
dotnet:release/11.0-preview7from
dariatiurina:backport/pr-67934-to-release-11.0-preview7

Conversation

@dariatiurina

@dariatiurina dariatiurina commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

[release/11.0-preview7] Fix Virtualize scroll jump from native/JS anchoring double-compensation

Backport of #67934 to release/11.0-preview7

Description

Virtualize in native scroll-anchoring mode (browsers that support CSS overflow-anchor — i.e. not Safari, and not <table> layouts) could jump to the start or end of the list while the user scrolled. When a scroll brought a spacer into view, Virtualize slid its render window (an intentional content shift) but the browser's overflow-anchor also tried to hold the content
still. Both authorities compensated the same shift, the viewport overshot, and edge convergence latched it to the top or bottom.

This change makes native overflow-anchor and Virtualize's own scroll handling cooperate so that exactly one authority acts per render, via a reason-counted nativeAnchoring.suspend/resume helper. All changes are confined to the useNativeAnchoring code paths; the manual JS compensation path used by Safari/WebKit and table layouts is unchanged.

Fixes #67729

Customer Impact

Customers using the Blazor Virtualize component (including QuickGrid) in Chromium/Firefox-based browsers see the list unexpectedly jump to the top or bottom during normal scrolling, making long lists effectively unusable. This is a visible functional regression introduced in preview.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Changes are scoped to the useNativeAnchoring code paths only; the non-native (Safari/table) compensation path is untouched. Covered by two new E2E tests plus the existing anchoring suite.

Verification

  • Manual (required)
  • Automated

Two E2E tests added to VirtualizationTest.cs (ItemsIncrementalScroll_DoesNotJumpToStartOrEnd and ViewportAnchoring_RenderlessAboveViewportResize_AfterScroll_VisibleItemStaysInPlace).

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@dariatiurina dariatiurina self-assigned this Jul 23, 2026
@dariatiurina dariatiurina added this to the 11.0-preview7 milestone Jul 23, 2026
@dariatiurina
dariatiurina requested a review from Copilot July 23, 2026 08:25
@dariatiurina
dariatiurina marked this pull request as ready for review July 23, 2026 08:27
@dariatiurina
dariatiurina requested a review from a team as a code owner July 23, 2026 08:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This backport addresses a Blazor Virtualize regression where native CSS scroll anchoring (overflow-anchor) could “fight” Virtualize’s own spacer-driven window sliding, causing sudden jumps to the start/end of long lists in Chromium/Firefox.

Changes:

  • Introduces a reason-counted native anchoring suspend/resume mechanism in Virtualize.ts to prevent double-compensation during spacer-triggered renders and convergence.
  • Threads _loading from Virtualize (C#) into the JS refreshObservers call so native anchoring can be resumed at the correct phase for async ItemsProvider renders.
  • Adds/updates test assets and E2E coverage to reproduce and validate the non-jumping behavior and anchoring restoration.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Components/Web/src/Virtualization/VirtualizeJsInterop.cs Extends JS interop to pass isLoading to refreshObservers.
src/Components/Web/src/Virtualization/Virtualize.cs Forwards _loading into RefreshObserversAsync after render.
src/Components/Web.JS/src/Virtualize.ts Implements native anchoring coordination (reason-counted suspend/resume) and refactors convergence tracking.
src/Components/test/testassets/BasicTestApp/VirtualizationComponent.razor Adjusts the “incorrect size” fixture to make the regression more reproducible and adds data-index.
src/Components/test/E2ETest/Tests/VirtualizationTest.cs Adds two new E2E tests and shared JS helpers for jump detection and render settling.

Comment thread src/Components/Web.JS/src/Virtualize.ts Resolved
Comment thread src/Components/Web.JS/src/Virtualize.ts Resolved
@ilonatommy ilonatommy added area-blazor Includes: Blazor, Razor Components feature-blazor-virtualization This issue is related to the Blazor Virtualize component labels Jul 23, 2026
@ilonatommy
ilonatommy temporarily deployed to copilot-pat-pool July 23, 2026 12:06 — with GitHub Actions Inactive
@ilonatommy
ilonatommy temporarily deployed to copilot-pat-pool July 23, 2026 12:07 — with GitHub Actions Inactive
@lewing
lewing merged commit 19fe163 into dotnet:release/11.0-preview7 Jul 23, 2026
37 of 39 checks passed
@Youssef1313 Youssef1313 added the tell-mode Indicates a PR which is being merged during tell-mode label Jul 27, 2026
@dariatiurina
dariatiurina deleted the backport/pr-67934-to-release-11.0-preview7 branch September 29, 2026 09:44

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 8e6fd432 Deployed Jul 23, 2026 by ilonatommy via conclusion #679
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components feature-blazor-virtualization This issue is related to the Blazor Virtualize component tell-mode Indicates a PR which is being merged during tell-mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants