Repository navigation
Fix Virtualize AnchorMode=End re-engaging bottom after user scrolls up. - #67555
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes an intermittent Blazor Virtualize behavior when using AnchorMode="End": after a user scrolls up, appends should no longer “snap” the viewport back to the bottom in the small-dataset / large-overscan regime (as observed in Aspire Dashboard console logs).
Changes:
- Track an End-follow state on the JS side and gate
scrollToBottom()so appends only pin to bottom when the user is actively following the end. - Extend the BasicTestApp anchor-mode playground with a “console scenario” (overscan + small dataset) for easier reproduction.
- Add an E2E regression test covering “small dataset + scroll up a few rows + append does not re-engage”.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Components/Web.JS/src/Virtualize.ts | Adds endFollowActive tracking and conditions scrollToBottom() on that follow state. |
| src/Components/test/testassets/BasicTestApp/VirtualizationAnchorMode.razor | Adds overscan configurability and a console-like scenario setup button for repro. |
| src/Components/test/testassets/BasicTestApp/Index.razor | Adds a navigation option to a console-logs-style viewer component. |
| src/Components/test/testassets/BasicTestApp/ConsoleLogsViewer.razor | Adds a console-like streaming log viewer to manually observe End anchoring behavior. |
| src/Components/test/E2ETest/Tests/VirtualizationTest.cs | Adds an E2E regression test for the small-dataset End anchoring append behavior. |
dariatiurina
reviewed
Jul 2, 2026
dariatiurina
reviewed
Jul 2, 2026
ilonatommy
enabled auto-merge (squash)
July 2, 2026 12:48
Member
Author
|
/ba-g template tests failures cannot be related |
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.
The Aspire dashboard "Console logs" view (a line-numbered LogViewer using
<Virtualize AnchorMode="End">) would snap the viewport back to the bottom whenever new lines arrived, even after the user had scrolled up to read earlier output. It was intermittent and only happened "on first visit" because it stopped once the log grew past a threshold.Reason for the failure
It happens when nothing is virtualized away, easy to achieve with high
OverscanCountvalue. On append, the runtime (Virtualize.cs ShouldScrollToBottomForAppend) asks the JS side to pin to the bottom while the total item count is still <= the visible item capacity.scrollToBottom()inVirtualize.tshonored that request unconditionally: it had no check whether the user was actually "following" the bottom, so an append re-engaged End-follow and moved the viewport down even when the user had deliberately scrolled up. Once the log exceeded the visible capacity, appends no longer requested a pin, which is why the bug only showed up early ("first visit / few lines").Fix
Track an
followingBottomflag that reflects whether the End-mode viewport is currently pinned at the bottom:AnchorModeincludes End,setAnchorMode).scrollToBottom()now pins to the bottom only whenfollowingBottomis true, so an append re-engages the bottom only if the user was still there; otherwise their scroll position is preserved.Before
EndAnchorModeVirtualize_before.mp4
After
EndAnchorModeVirtualize.1.mp4