angular / angular/components

bug(mat-list): Badge within list item gets cut off

Offen
#26,528 1 Kommentar 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/list P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### Is this a regression?

- [X] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

14

### Description

When placing a badge within a list item, the badge gets cut off:

image

This problem has already been [mentioned before](https://github.com/angular/components/issues/12384). However, back then it was easy to apply a workaround: set `overflow: visible` or add some padding to the parent element. With the mdc migration, this has become much harder because Angular Material adds wrapping elements to list items, of which we have little control. And in v14, it works just fine, even without workaround.

### Reproduction

Steps to reproduce:
1. Create a mat-(nav-)list
2. Add a badge on an element within the list

StackBlitz: https://stackblitz.com/edit/angular-hgiusr

### Expected Behavior

The badge should be fully visible

### Actual Behavior

The badge gets cut off

### Environment

- Angular: 15.1.0
- CDK/Material: 15.1.2
- Browser(s): Chrome 109.0.5414.87
- Operating System (e.g. Windows, macOS, Ubuntu): macOS Ventura

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der verknüpften StackBlitz-Reproduktion und untersuche das Verhalten von mat-list- und mat-nav-list-Badges unter der MDC-Implementierung von Angular Material. Reproduziere das abgeschnittene Badge und überprüfe anschließend, dass das Badge vollständig sichtbar ist, ohne dass ein Workaround erforderlich ist.

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
35/100

Neue Issues direkt in Ihr Postfach

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