angular / angular/components

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

Ouverte
#26,579 19 commentaires 73 réactions 0 personnes assignées Voir sur GitHub
area: material/form-field P2
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?

- [ ] 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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la reproduction StackBlitz liée et la configuration mat.form-field-density(-2) pour un fill mat-form-field. Inspectez le CSS généré pour mat-label à des densités inférieures à -1 ; le travail est terminé lorsque les labels restent visibles, avec un comportement identique à celui des densités de -1 et supérieures, et qu'une couverture de régression existe pour le cas reproduit.

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

Évaluation

Stack technique
angular, sass
Domaine
design, frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
58/100

Recevez les nouvelles issues par e-mail

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