angular / angular/components

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

Ouverte
#26,528 1 commentaire 3 réactions 0 personnes assignées Voir sur GitHub
area: material/list P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la reproduction StackBlitz liée et examinez le comportement des badges de mat-list et mat-nav-list avec l’implémentation MDC d’Angular Material. Reproduisez le badge tronqué, puis vérifiez que le badge est entièrement visible sans nécessiter de workaround.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.