Repository navigation
Description
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
dotnet new blazor --interactivity Server, and add the page below.- Run it and open
/hover. - Put the pointer over the list and turn the mouse wheel about 15 notches.
- 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
github-actions commentedon Nov 12, 2026
Triage Summary
Area:
area-blazor(Virtualizecomponent,src/Components/Web.JS/src/Virtualize.ts)Type:
Bug(preserved)Regression Info
Potential Duplicates
Notes
kotlarmilos commentedon Nov 25, 2026
The fix in #70658 is merged into
main.In the meantime, you can restore the .NET 10 behavior by setting
overflow-anchor: noneon the scroll container that hostsVirtualize:Setting
overflow-anchor: noneon the rows has the same effect. With this change, wheel input tracksscrollTopexactly, as it did in .NET 10.