angular / angular/components

bug(MatTable): Nested MatTable's rows have no border if I expand last row of parent MatTable

Offen
#28,773 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
area: material/table needs: discussion P5
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### 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

When I have a nested MatTable set with expand feature, when I expand the last row of the parent table, all the cells in the child MatTable will have no border.
![image](https://github.com/angular/components/assets/65027545/dbbc6ed3-0e3b-46e3-ada7-d45e95e29772)

But If I am expanding any other rows except the last row, the nested MatTable is displaying fine.
![image](https://github.com/angular/components/assets/65027545/7575e8d5-770d-4526-94ba-659906241e6e)

I have found the reason that the styles from last row .mat-cell of the parent MatTable is being applied to all the child MatTable's .mat-cell

![image](https://github.com/angular/components/assets/65027545/1831a5c1-ba1a-4783-b86d-34578ce260b6)

### Reproduction

StackBlitz link: https://stackblitz.com/edit/5djdhn?file=src%2Fexample%2Ftable-expandable-rows-example.ts
Steps to reproduce:
1. Expand the 1st row of the MatTable and check row borders
2. Expand the last row of the MatTable and checkl the absence of row borders of the rows

### Expected Behavior

Only the last row of the nested MatTable will be applied with the `border-bottom: none` styles. not all the rows

### Actual Behavior

Every row inside the last row of MatTable's child MatTable is applied with `border-bottom: none` styles.

### Environment

Angular CLI: 17.0.1
Node: 18.19.0
Package Manager: npm 10.2.3
OS: win32 x64

Angular: 17.0.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.1700.1
@angular-devkit/build-angular 17.0.1
@angular-devkit/core 17.0.1
@angular-devkit/schematics 17.0.1
@angular/cdk 17.0.1
@angular/cli 17.0.1
@angular/material 17.0.1
@angular/material-luxon-adapter 17.0.1
@schematics/angular 17.0.1
rxjs 7.8.1
typescript 5.2.2
zone.js 0.14.2

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit dem StackBlitz-Einstiegspunkt unter src/example/table-expandable-rows-example.ts und reproduziere das Problem, indem du zuerst die erste Zeile und dann die letzte Zeile erweiterst. Untersuche, wie die verschachtelten MatTable-Zeilen das Rahmen-Styling der letzten Zeile der übergeordneten Tabelle erhalten. Als erledigt gilt die Aufgabe, wenn nur die letzte Zeile der verschachtelten Tabelle border-bottom: none hat, während die übrigen untergeordneten Zeilen ihre Rahmen behalten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.