Skip to content

Conversation

dariatiurina
Copy link
Contributor

Fix the bug with scrolling in Virtualize component with scaled elements

Description

This pull request improves the Virtualize component’s handling of CSS scaling and transforms, ensuring correct virtualization behavior when parent elements use scale, zoom, or transform properties. It also adds new test to verify these changes.

Changes:

  • Updated Virtualize.ts to detect and correctly handle CSS scale, zoom, and transform properties on parent elements, adjusting scroll calculations so virtualization works accurately under scaling scenarios.
  • Added a new test CanScrollWhenAppliedScale to verify that virtualization works when CSS scale is applied.

Fixes #59354

@github-actions github-actions bot added the area-blazor Includes: Blazor, Razor Components label Oct 13, 2025
@dariatiurina dariatiurina self-assigned this Oct 13, 2025
@dariatiurina dariatiurina marked this pull request as ready for review October 13, 2025 14:56
@dariatiurina dariatiurina requested a review from a team as a code owner October 13, 2025 14:56
@Copilot Copilot AI review requested due to automatic review settings October 13, 2025 14:56
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the Virtualize component where scroll calculations were incorrect when CSS scaling transforms were applied to parent elements. The issue occurred because the component used physical pixel measurements without accounting for scale factors.

  • Adds scale factor detection and compensation logic to handle CSS scale, zoom, and transform properties
  • Converts physical pixel measurements to logical pixels for accurate virtualization calculations
  • Includes test coverage for the scaling scenario with a new E2E test

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
VirtualizationScale.razor New test component demonstrating virtualization with CSS scale applied to body
QuickGridVirtualizeComponent.razor Fixes items provider to respect pagination parameters
Index.razor Adds new test component to navigation options
VirtualizationTest.cs Adds E2E test to verify virtualization works with scaling
Virtualize.ts Core fix - adds scale factor detection and applies compensation to scroll calculations

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blazor Virtualize Feature Bug with Scaled Elements Causing Scroll Errors

1 participant