Skip to content

Warning message (cdk-virtual-scroll-viewport): When no height is set. #26133

Open
@ifch0o1

Description

@ifch0o1

Feature Description

I know this is a very insignificant "feature", but I think it will be helpful.

<cdk-virtual-scroll-viewport> require fixed height to be set.
Without height it doesn't render any elements at all (even the html structure stays empty). This can be verry misleading and time consuming in some cases.
I just taked sandbox example with static data and modifyed it to take async data.
I was tired and spend few hours thinking about that is a bug in my code flow (timing, data refreshing or something else).
Today on a fresh mind I realize it's just because it has no height.

Maybe if you just warn the user to set height if there is no height or maybe set min-height = single element height. This can help to prevent others to make this mistake.

Use Case

image
When we have data and no height - no html is rendered. If there is a console.warn('there is no height man.') will be very obviously and catchable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/scrollingfeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions