Skip to content

bug(VirtualScroll): Horizontal scrolling inside cdk-virtual-scroll-viewport #24277

@Spinnenzunge

Description

@Spinnenzunge

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

Content inside the cdk-virtual-scroll-viewport does use more than 100% width and does not break anymore and instead adds horizontal scrolling.

This is especially a problem when using following css rules:

white-space: nowrap;
overflow: hidden;

The problem is the created wrapper container with the cdk-virtual-scroll-content-wrapper class that has a min-width: 100% set but no max-width and can not be changed because of the view encapsulation.

Reproduction

https://github.com/DaniLopes2003/VirtualScroll-DemoApp

Expected Behavior

No horizontal scroll bar added or width, max-width and min-width customizable with css variables?

Actual Behavior

Horizontal bar added because no min-width is set

Environment

  • Angular: 13.0.3
  • CDK/Material: 13.1.3
  • Browser(s): Chrome, Safari
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS

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/scrolling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions