Skip to content

Virtualize regression in .NET 11: wheel scrolling runs ahead by whole windows in a div scroller when hovering a row changes its layout #70541

Closed

Description

@tombrewer-onwave

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

In .NET 11, Virtualize in a non-table scroll container leaves the browser's scroll anchoring on. Virtualize.ts sets overflow-anchor: none only on the two spacers, and on the scroll container only while a "slide" is suspended. .NET 10 set overflow-anchor: none on the scroll container for good.

If hovering a row changes layout inside the scroller (for example a button that is display: none until :hover), wheel scrolling with the pointer over the list runs ahead. Each time the window slides, scrollTop rises by the growth of the before-spacer. That brings the after-spacer back into view, which slides the window again, so the list keeps moving after the wheel stops. A few wheel ticks travel thousands of pixels.

With the same page and no layout change on hover, the list tracks the wheel exactly.

Expected Behavior

scrollTop follows the wheel, as on .NET 10 and as on .NET 11 without the hover rule.

Pointer over the list, 15 wheel ticks of 200 px, 60 ms apart:

Runtime Hover reveals a button Hover changes nothing
.NET 10.0.15 3000 (Row 0078) 3000 (Row 0078)
.NET 11.0.0 6914 at the last tick, 9194 (Row 0241) 1.5 s later, with no further input 3000 (Row 0078)

.NET 11 scrollTop after each tick: 200, 400, 904, 1104, 2140, 2340, 2920, 3120, 4156, 4356, 5316, 5516, 6134, 6334, 6914. The exact numbers vary between runs; the overshoot does not.

Steps To Reproduce

  1. dotnet new blazor --interactivity Server, and add the page below.
  2. Run it and open /hover.
  3. Put the pointer over the list and turn the mouse wheel about 15 notches.
  4. Untick the checkbox and repeat: the list tracks the wheel.
@page "/hover"
@rendermode InteractiveServer
@using Microsoft.AspNetCore.Components.Web.Virtualization

<p>@System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription</p>
<p><label><input type="checkbox" @bind="reveal" /> Row hover reveals a button</label></p>

<style>
    .hrow { height: 38px; box-sizing: border-box; border-bottom: 1px solid #eee; display: flex; align-items: center; }
    .hrow .more { display: none; margin-left: auto; }
    .reveal .hrow:hover .more { display: inline-block; }
</style>

<div id="list" class="@(reveal ? "reveal" : null)" style="height: 630px; overflow-y: auto; border: 1px solid #999;">
    <Virtualize ItemsProvider="LoadAsync" Context="row" OverscanCount="6">
        <ItemContent>
            <div class="hrow"><span>@row.Name</span><button class="more">More</button></div>
        </ItemContent>
        <Placeholder>
            <div class="hrow">Loading</div>
        </Placeholder>
    </Virtualize>
</div>

@code {
    private static readonly List<Row> All = Enumerable.Range(0, 1000).Select(i => new Row(i, $"Row {i:D4}")).ToList();

    private bool reveal = true;

    private async ValueTask<ItemsProviderResult<Row>> LoadAsync(ItemsProviderRequest request)
    {
        await Task.Delay(5, request.CancellationToken);
        return new ItemsProviderResult<Row>(All.Skip(request.StartIndex).Take(request.Count), All.Count);
    }

    private sealed record Row(int Id, string Name);
}

Rows are not keyed, as in most ItemContent templates.

Exceptions (if any)

None.

.NET Version

11.0.100 (Microsoft.AspNetCore.App 11.0.0). Not affected: 10.0.15.

Anything else?

Regression from .NET 10. Not in the 11.0 release notes or breaking-changes list. Chrome 157 (via Playwright), Windows 11, real wheel input.

A trace from a real app with the same shape (38 px rows), 4 wheel ticks only, then hands off:

244 scroll 800
246 scroller overflow-anchor: none      (slide suspended)
256 rows patched in place, before-spacer 0 -> 418px
258 scroller overflow-anchor: ''        (resumed)
434 scrollTop is 1218 (+418)            -> after-spacer visible again
443 before-spacer -> 798px
444 resumed
452 scroll 1598 (+380)
...                                     repeats every ~150 ms, +380 each time
1691 scrollTop 5018, still going

Row elements are reused for other items when the window slides (no @key), so an element the browser holds as its scroll anchor sits one slide lower after the render. Our reading is that the hover-driven layout lets the browser record that anchor just before the slide, and the anchor is applied once anchoring resumes. We did not confirm the browser internals.

Workaround: overflow-anchor: none on the scroll container (what .NET 10 did), or on the rows. Either makes 15 × 200 px land on 3000 again.

Source (v11.0.0): src/Components/Web.JS/src/Virtualize.ts: useNativeAnchoring, the spacer-only overflow-anchor, nativeAnchoring.suspend('slide') and resume('slide'). v10.0.0 Virtualize.ts set (scrollContainer || document.documentElement).style.overflowAnchor = 'none';.

Related: #67729 (closed, preview 4; jumps to the beginning or end while scrolling, different symptom). #70409 (open; AnchorMode.End and ScrollToItemAsync, different symptom).

Also filed: #70540 (a separate .NET 11 Virtualize regression: a list that grows while scrolled jumps, then ignores scripted scrolls).

Activity

  1. added
    area-blazor
    on Nov 12, 2026
  2. github-actions commented on Nov 12, 2026

    @github-actions
    Contributor

    Triage Summary

    Area: area-blazor (Virtualize component, src/Components/Web.JS/src/Virtualize.ts)
    Type: Bug (preserved)

    Regression Info

    • Previously working version: .NET 10.0.15 (reporter-supplied)
    • Failing version: .NET 11.0.0 (reporter-supplied)
    • Same page: scrollTop tracks the wheel (3000 after 15 × 200 px) on .NET 10.0.15; on .NET 11.0.0 it overshoots when hover changes row layout.

    Potential Duplicates

    • None found

    Notes

    Generated by Issue Triage Agent for dotnet/aspnetcore for #70541 · copilot · auto · 22.4 AIC · ⌖ 1.01 AIC · ⊞ 7.5K · ◷

  3. added this to the 11.0.x milestone on Nov 16, 2026
  4. kotlarmilos commented on Nov 25, 2026

    @kotlarmilos
    Member

    The fix in #70658 is merged into main.

    In the meantime, you can restore the .NET 10 behavior by setting overflow-anchor: none on the scroll container that hosts Virtualize:

    <div style="height: 630px; overflow-y: auto; overflow-anchor: none;">
        <Virtualize ...>

    Setting overflow-anchor: none on the rows has the same effect. With this change, wheel input tracks scrollTop exactly, as it did in .NET 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Regressionarea-blazor

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions