angular / angular/components

bug(form-field): mat-label disappears when density < -1

Offen
#26,579 19 Kommentare 73 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/form-field P2
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

Hi,
There seems to be an issue where the mat-labels disappear when the density of form-field is set to lower than -1. I don't think this is as designed...

### Reproduction

Steps to reproduce:
1. Set the density option to anything lower than -1, ex: `@include mat.form-field-density(-2);`
2. Include a mat-form-field with the appearance set to "fill", with a mat-label

notice the labels do not appear. (Their css is set as "display:none;")

Demo: https://stackblitz.com/edit/angular-wvlwej
In the stackblitz, you can see that the labels appear fine when density is set at >= -1, but anything lower and the label is hidden.

![image](https://user-images.githubusercontent.com/8459019/217098883-527e1c7c-71a2-4cb2-8c3e-2dc2c6a1b964.png)

### Expected Behavior

The labels should be visible

### Actual Behavior

The labels are not visible

### Environment

- Angular: 15.1.3
- CDK/Material: 15.1.3
- Browser(s): Chrome Version 109.0.5414.120
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der verknüpften StackBlitz-Reproduktion und der mat.form-field-density(-2)-Konfiguration für ein fill mat-form-field. Untersuche das generierte CSS für mat-label bei Dichten unter -1; als erledigt gilt die Aufgabe, wenn die Labels sichtbar bleiben, sich bei Dichten von -1 und höher gleich verhalten und eine Regression-Abdeckung für den reproduzierten Fall vorhanden ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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