Skip to content

[cdk-virtual-scroll-viewport][mat-table] - sticky headers is not working properly when combining mat-table with cdk-virtual-scroll-viewport #18240

@kriswinbush

Description

@kriswinbush

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/fork/components-issue
https://stackblitz.com/edit/virtual-scroll-table-sticky-headers

Steps to reproduce:

  1. wrap mat-table within a cdk-virtual-scroll-viewport element
  2. add sticky: true property to *matHeaderRowDef directive as stated in documentation
  3. observe sticky header slide down the viewport after about 10 rows.

Expected Behavior

Expect when adding the sticky:true; property to mat-table *matHeaderRowDef directive wrapped within a cdk-virtual-scroll-viewport that the headers remain positioned at the top of the viewport.

Actual Behavior

As you scroll the cdk-virtual-scroll-viewport slides the entire mat-table instead of just the row contents wrapped in the tbody element.

Environment

  • Angular: >= 7
  • CDK/Material: >= 7
  • Browser(s): chrome, firefox, opera, safari
  • Operating System (e.g. Windows, macOS, Ubuntu): all

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