Skip to content

bug([mat-table]): mat-tab-group messes up expandable rows in table #19838

@Diralytic

Description

@Diralytic

Reproduction
Stackblitz project: https://stackblitz.com/edit/github-itepdn
To see the bug, just open the app, switch to the second tab and go back to the first one.
The bug only shows with enabled Ivy compiler.

Expected Behavior
Switching tabs in mat-tab-group shouldn't affect the expanded rows in the table.

Actual Behavior
All rows in the table are expanded after switching to the second tab and back. This shouldn't be possible as normally the table allows only for one expanded row at a time.

Environment

  • Angular: 9.1.0
  • CDK/Material: 9.2.0
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows and Ubuntu
  • Enabled Ivy

Known workarounds

  • Disable Ivy
{
  ...
  "angularCompilerOptions": {
    "enableIvy": false,
    ...
  }
}

  • Lazy load tab
    <mat-tab label="Table">
       <ng-template matTabContent>
         <app-table></app-table>
       </ng-template>
    </mat-tab>

Is there any other clean solution without disabling ivy or lazy loading tabs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/expansion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions