Repository navigation
Virtualize tests with ItemProvider should always contain a delay - #67959
Merged
Merged
Conversation
…om deterministic - wait for the placeholders to transform to real items, only then scroll down and check if the initial landing was at the bottom or bumped up.
…-render In End anchor mode, bottomTracking.reached is sticky-true so the bottom re-pin (scrollTop = scrollHeight) re-fires on every render. After the user pressed Home, an async ItemsProvider re-render would re-engage that re-pin and pull the viewport back to the bottom, so item 0 never became visible (one Home press should reach the top). The Home handler only cleared the follow state for non-End modes, leaving End mode's sticky state intact.
…ollowToBottom The test clicked "Append 100 items" and immediately measured the gap between the viewport and the bottom. With an async ItemsProvider, list only grows inside the provider callback (Task.Yield + 500ms delay), so the assertion ran before scrollHeight had grown. The gap was ~0, falsely looking like None mode had followed to the bottom. Wait for scrollHeight to grow by the appended items before asserting the viewport stayed in place.
Open
3 tasks
…/www.w3.org/TR/css-scroll-anchoring-1/). We have to use manual anchoring then.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Blazor Virtualize/QuickGrid E2E test matrix to consistently exercise ItemsProvider behavior under realistic latency, and fixes a few latency-revealed scroll/anchoring behaviors in the JS Virtualize implementation.
Changes:
- Updated
Virtualize.tsbottom-follow and anchor snapshot behavior to handle delayed provider scenarios and Home/End jump interactions more reliably. - Added/extended test asset toggles (delay controls) to simulate provider latency for Virtualize and QuickGrid scenarios.
- Refactored E2E tests to enable provider delay for
ItemsProviderpaths by default, and added targeted regression tests for delayed Home/End behaviors.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Components/Web.JS/src/Virtualize.ts | Adjusts follow/pinning and anchor snapshot logic to fix delayed-provider scroll/anchoring issues. |
| src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Virtualization/VirtualizeAppendRepro.razor | Adds query-configurable provider delay for server-rendering append repro coverage. |
| src/Components/test/testassets/BasicTestApp/VirtualizationAnchorModeWindowScroll.razor | Adds UI toggle to simulate provider delay in window-scroll anchor mode test asset. |
| src/Components/test/testassets/BasicTestApp/QuickGridTest/QuickGridVariableHeightComponent.razor | Adds UI toggle to simulate provider delay in QuickGrid variable-height test asset. |
| src/Components/test/E2ETest/Tests/VirtualizationTest.cs | Enables delay for ItemsProvider-based tests, refactors mounting helpers, and adds new delayed Home/End regression tests. |
| src/Components/test/E2ETest/ServerRenderingTests/VirtualizationRenderModesTest.cs | Adds provider delay to the server-rendering append test navigation URL. |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
dariatiurina
approved these changes
Jul 24, 2026
dariatiurina
left a comment
Contributor
There was a problem hiding this comment.
Great refactoring! Virtualize.ts is now a joy to look at. Thank you so much!
ilonatommy
enabled auto-merge (squash)
July 24, 2026 15:10
Member
Author
|
/backport to release/11.0-preview7 |
Contributor
|
Started backporting to |
Contributor
|
@ilonatommy backporting to git am output$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: All ItemProvider tests should use delay to reproduce real life scenario.
Using index info to reconstruct a base tree...
M src/Components/test/E2ETest/Tests/VirtualizationTest.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Components/test/E2ETest/Tests/VirtualizationTest.cs
CONFLICT (content): Merge conflict in src/Components/test/E2ETest/Tests/VirtualizationTest.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 All ItemProvider tests should use delay to reproduce real life scenario.
Error: The process '/usr/bin/git' failed with exit code 128 |
Merged
5 of 10 tasks
akoeplinger
pushed a commit
that referenced
this pull request
Jul 27, 2026
…67959) (#68036) * All ItemProvider tests should use delay to reproduce real life scenario. * Make failures of `AnchorMode_VariableHeight_EndKeyFromTop_JumpsToBottom deterministic - wait for the placeholders to transform to real items, only then scroll down and check if the initial landing was at the bottom or bumped up. * Fix Virtualize End-key not converging to true bottom in None/Start anchor modes. * Fix Virtualize End-mode Home key not converging to top after async re-render * Fix race in AnchorMode_WindowScroll_None_LargeAppendAtBottom_DoesNotFollowToBottom * Native anchoring has one blind spot: topmost scroll position (https://www.w3.org/TR/css-scroll-anchoring-1/). We have to use manual anchoring then. * When we don't have container (document/window scroll scenarios) then native scroll works fine.
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.
Real life
ItemProvideralways comes with some delay.VirtualizeandQuickGridvirtualized tests do not make sense for providers which justawait Task.Yield(). This PR makes sure allAnchorMode/ScrollToItem/InitialItemIndextests added in net11 have consistent coverage of delayed case. The list of edited tests is below (expand). Only 3 tests show UX issues in the delayed version.Edited tests - initial results before framework changes
AnchorMode_Bottom_PrependKeepsViewportStableAnchorMode_DeleteAboveViewport_ViewportStaysStableAnchorMode_DeleteAtViewportTop_FirstSurvivingItemJumpsToTheTopAnchorMode_DeleteBelowViewport_ViewportStaysStableAnchorMode_End_AppendAfterLeavingBottom_DoesNotReengageAnchorMode_End_AppendAtBottom_ViewportFollowsAnchorMode_End_AppendAtMidList_DoesNotAutoScrollAnchorMode_End_GrowingDataset_AppendFollowsToBottomAnchorMode_End_HomeKeyFromBottom_JumpsToTop(variableHeight: False)
AnchorMode_End_LargeAppendAtBottom_StillFollowsAnchorMode_End_MidList_ViewportStableAnchorMode_End_PrependAtTop_ViewportStaysStableAnchorMode_End_SmallDataset_AppendAfterScrollingUpAFewRows_DoesNotReengageAnchorMode_End_SmallDataset_AppendFollowsToBottomAnchorMode_EndKeyJumpsToBottomAnchorMode_HomeKeyJumpsToTopAnchorMode_MidList_AppendKeepsViewportStableAnchorMode_NearTop_AppendKeepsViewportStableAnchorMode_NearTop_PrependKeepsViewportStableAnchorMode_None_AppendAtBottom_NoAutoScrollAnchorMode_None_AsyncProvider_PrependKeepsViewportStableAnchorMode_None_AsyncProvider_ScrollDoesNotFlashAnchorMode_None_ItemExpansionAfterPrepend_NoGapAnchorMode_None_LargeAppendAtBottom_DoesNotFollowToBottomAnchorMode_None_MidList_ViewportStableAnchorMode_None_PrependAtTop_ViewportStaysStableAnchorMode_Start_AppendAtBottom_ViewportStableAnchorMode_Start_LargeAppendAtBottom_DoesNotFollowToBottomAnchorMode_Start_LargePrependAtTop_StillShowsNewItemsAnchorMode_Start_MidList_ViewportStableAnchorMode_Start_PrependAfterLeavingTop_DoesNotReengageAnchorMode_Start_PrependAtTop_NewItemsVisibleAnchorMode_Start_SmallAppendAtBottom_ViewportStableAnchorMode_Start_SmallDataset_PrependAfterScrollingDownAFewRows_DoesNotReengageAnchorMode_Top_AppendKeepsViewportStableAnchorMode_VariableHeight_EndKeyFromTop_JumpsToBottomAnchorMode_WindowScroll_End_AppendAtBottom_ViewportFollowsAnchorMode_WindowScroll_End_MidList_ViewportStableAnchorMode_WindowScroll_End_PrependAtTop_ViewportStaysStableAnchorMode_WindowScroll_EndKeyJumpsToBottomAnchorMode_WindowScroll_HomeKeyJumpsToTopAnchorMode_WindowScroll_None_LargeAppendAtBottom_DoesNotFollowToBottomAnchorMode_WindowScroll_None_MidList_ViewportStableAnchorMode_WindowScroll_None_PrependAtTop_ViewportStaysStableAnchorMode_WindowScroll_Start_AppendAtBottom_ViewportStableAnchorMode_WindowScroll_Start_MidList_ViewportStableAnchorMode_WindowScroll_Start_PrependAtTop_NewItemsVisibleEndAnchoredAppend_IssuesExactlyTwoProviderCalls_AdvancingToTailInitialIndex_BeyondCount_ClampsToEndInitialIndex_OpensAtTargetWithRealContentQuickGrid_AnchorMode_Bottom_AppendKeepsViewportStableQuickGrid_AnchorMode_Bottom_PrependKeepsViewportStableQuickGrid_AnchorMode_DefaultComparer_Items_PrependKeepsViewportStableQuickGrid_AnchorMode_End_AppendAfterLeavingBottom_DoesNotReengageQuickGrid_AnchorMode_End_LargeAppendAtBottom_StillFollowsQuickGrid_AnchorMode_End_MidList_ViewportStableQuickGrid_AnchorMode_End_PrependAtTop_ViewportStaysStableQuickGrid_AnchorMode_EndKeyJumpsToBottomQuickGrid_AnchorMode_HomeKeyJumpsToTopQuickGrid_AnchorMode_MidList_AppendKeepsViewportStableQuickGrid_AnchorMode_NearTop_AppendKeepsViewportStableQuickGrid_AnchorMode_NearTop_PrependKeepsViewportStableQuickGrid_AnchorMode_None_AsyncProvider_PrependKeepsViewportStableQuickGrid_AnchorMode_None_AsyncProvider_ScrollDoesNotFlashQuickGrid_AnchorMode_None_LargeAppendAtBottom_DoesNotFollowToBottomQuickGrid_AnchorMode_None_MidList_ViewportStableQuickGrid_AnchorMode_None_PrependAtTop_ViewportStaysStableQuickGrid_AnchorMode_Start_LargeAppendAtBottom_DoesNotFollowToBottomQuickGrid_AnchorMode_Start_MidList_ViewportStableQuickGrid_AnchorMode_Start_PrependAfterLeavingTop_DoesNotReengageQuickGrid_AnchorMode_Start_PrependAtTop_NewItemsVisibleQuickGrid_AnchorMode_Top_AppendKeepsViewportStableQuickGrid_CanJumpToEndAndStartScrollToItem_AnchorStart_AtTop_LandsAtTargetScrollToItem_AsyncProvider_VariableHeight_WithDelay_ReachesTargetScrollToItem_ExternalCancellation_TaskCancelsScrollToItem_FixedHeight_LandsAtTopScrollToItem_ForwardThenBackwardScrollToItem_MaxIntIndex_ScrollsToLastScrollToItem_NegativeIndex_ScrollsToTopScrollToItem_RapidCalls_OnlyLastTargetReachedScrollToItem_UserScrollDuringProviderFetch_UserScrollWinsScrollToItem_VariableHeight_LandsAtTopScrollToItem_WithProviderDelay_NoPlaceholderAtTargetWindowScroll_ScrollToItem_LandsAtTargetFix
AnchorMode_VariableHeight_EndKeyFromTop_JumpsToBottom (anchorMode 0=None, 1=Start)Bug: convergence mechanism worked for placeholders only, end jump lands at the bottom only when placeholders are loaded, when real items load it bumps back up. The re-pinning mechanism designed for this situations was enabled only for
Endanchor mode.Fix: All modes use re-pinning mechanism when placeholder->items transition turnes out to grow
scrollHeight(so the real items were bigger than placeholders). 7b24733AnchorMode_End_HomeKeyFromBottom_JumpsToTop (variableHeight True/False)Bug: In
Endmode with provider with delay, at the bottom of the list user wants to jump Home but after a brief jump up, the convergence mechanism pulls the scroll back down to the end of the list. It's becausebottomTracking.reachedvariable was sticky-true, never flipped back.Fix: disable auto-follow mechanism for all modes on
Homejump. 5c9ca3fAnchorMode_End_PrependAtTop_ViewportStaysStable(variableHeight: False, useItemsProvider: True)started failing after we merged this PR with main taht had changes from Fix Virtualize scroll jump from native/JS anchoring double-compensation #67934. It revealed a blind spot of native anchoring: when atscrollTop=0(so topmost), the anchoring won't get triggered by prepend - it's supressed by design. That's why we need 83bac7a to apply manual anchoring for that case.