Skip to content

Blazor Virtualization flickers when scrolling #64142

@cplaiu

Description

@cplaiu

I'm trying to create a grid layout using display: grid, but I noticed that when the items are rendered, the first and last child elements of the grid appear empty due to the placeholder divs generated by the Virtualize component.

I attempted to fix this issue with the following CSS:

.ns-container-product > div:first-child,
.ns-container-product > div:last-child {
  min-height: 0;
  padding: 0;
  margin: 0;
  border: none;
  grid-column: 1 / -1;
}

However, this solution creates a full empty row, which sometimes results in unwanted blank space.

I also tried using display: contents;, but in that case, the items are not rendered the first time the component loads.

As an alternative, I switched to using flex-wrap: wrap, but this causes a noticeable flicker when scrolling.

It seems that this behavior might be related to the following issue: dotnet/aspnetcore#39468.

I've attached a sample project where the problem can be reproduced, along with a video showing the flicker effect.

VritualizeBlazorNET8.

2025-10-23.11-06-08.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions