Skip to content

[card] Using a card inside a grid via Flow's component column breaks row layout #9077

@stefanuebe

Description

@stefanuebe

Description

I have a simple, one column grid, where the card component is used to render the content. While it is displayed correctly initially, it breaks when scrolling further down - the grid does not always calculate the row height correctly. But even that is not consistent. Some rows are displayed correctly, some are not. It is not really predictable.

Initial displayment

Image

When scrolling down

Image

Expected outcome

The card should be rendererd correctly.

Minimal reproducible example

Grid<String> grid = new Grid<>();

grid.addComponentColumn(s -> {
    Card card = new Card();
    card.setTitle(s);
    card.setSubtitle(new Span("Subtitle " + s));
    return card;
});

grid.setItems(IntStream.range(0, 200).mapToObj(i -> "Item " + i).toList());

setSizeFull();
setFlexGrow(1, grid);

add(grid);

Steps to reproduce

  1. Add the snippet to a Flow app
  2. Scroll the grid

Environment

Vaadin version(s): 24.8.0.alpha6
OS: Windows 11

Browsers

Chrome and FF

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions