angular / angular/components

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

Aperta
#26,579 19 commenti 73 reazioni 0 assegnatari Vedi su GitHub
area: material/form-field P2
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dalla riproduzione StackBlitz collegata e dalla configurazione mat.form-field-density(-2) per un fill mat-form-field. Ispeziona il CSS generato per mat-label alle densità inferiori a -1; il lavoro è completato quando le label rimangono visibili, con un comportamento corrispondente a quello delle densità pari o superiori a -1, e con una copertura di regressione per il caso riprodotto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, sass
Ambito
design, frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
58/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.