bug(mat-label): trailing white-space between text and asterisk
- 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
It's all in the title.
Might be related to https://github.com/angular/components/issues/27722.
### Reproduction
https://stackblitz.com/edit/vcau9e
### Expected Behavior
White-space should be trimmed (e. g. by making mat-label `display: inline-block`).
### Actual Behavior
I see UI being dependent on html formatting.
### Environment
```
Angular CLI: 16.2.9
Node: 18.12.0
Package Manager: yarn 1.22.19
OS: win32 x64
Angular: 16.2.12
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.1602.9
@angular-devkit/build-angular 16.2.9
@angular-devkit/core 16.2.9
@angular-devkit/schematics 16.2.9
@angular/cdk 16.2.11
@angular/cli 16.2.9
@angular/fire 7.6.1
@angular/material 16.2.11
@angular/material-moment-adapter 16.2.11
@schematics/angular 16.2.9
rxjs 7.8.1
typescript 5.1.6
webpack 5.89.0
zone.js 0.13.3
```
Also reproducible in version 15.
Contributor guide
Research direction
Start with the linked StackBlitz reproduction and compare the reported mat-label rendering in Angular Material versions 14–16. Trace the mat-label component and its styling to determine why HTML formatting affects the gap before the asterisk. Done means equivalent label markup renders without trailing whitespace and a regression test covers the behavior.
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