bug(mat-list): Badge within list item gets cut off
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 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:

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
Contributor guide
Research direction
Start with the linked StackBlitz reproduction and inspect the Angular Material mat-list and mat-nav-list badge behavior under the MDC implementation. Reproduce the clipped badge, then verify that the badge is fully visible without requiring a workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100