Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug(cdk-virtual-scroll-viewport): renders gaps between items #32148

@yichengyiguo

Description

@yichengyiguo

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

This issue was previously reported but closed without a fix. I believe it should be revisited — when using cdk-virtual-scroll-viewport with *cdkVirtualFor, items sometimes render with visible gaps between rows. It appears to be caused by subpixel rounding when calculating item offsets, possibly due to the use of CSS transform for positioning.

Image

reference: #31824

Reproduction

StackBlitz link:
Steps to reproduce:

  1. Set a solid background color for the cdk-virtual-scroll-viewport.
  2. Set a different background color for each item rendered with *cdkVirtualFor.
  3. Zoom the browser window (e.g. 300%) and scroll quickly through the list.

Expected Behavior

Rows should be rendered continuously without visible gaps between them.

Actual Behavior

At certain scroll positions or zoom levels, a thin gap appears between consecutive rows.

Environment

Angular: 20.2.2

Angular CDK: 20.2.9

Browser: Chrome 139, Edge 139 (Windows 10, macOS tested)

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions