angular / angular/components

bug(mat-form-field): form field with mat-label and without mat-label not vertically aligned

Ouverte
#27,086 3 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
area: material/form-field P3
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?

- [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 two mat-form-fields are in a div and one has a mat-label while the other one hasn't, the fields are not aligned vertically.

The `display` property on `.mat-form-field` was changed from `inline-block` to `inline-flex`. Changing it back seems to solve the issue.

### Reproduction

https://stackblitz.com/edit/cjzlva?file=src%2Fapp%2Fform-field-overview-example.html

### Expected Behavior

Form fields are aligned vertically

### Actual Behavior

Forms fields are not aligned

### Environment

- Angular: 15.2.9 / 16.0.1
- CDK/Material: 15.2.9 / 16.0.1
- Browser(s): Chrome 113 / FireFox 113
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Ouvrez la reproduction StackBlitz liée et comparez les deux mat-form-fields, puis examinez la règle display de .mat-form-field, qui est passée de inline-block à inline-flex. Confirmez le correctif en vérifiant que les champs avec et sans mat-label s’alignent verticalement dans les versions d’Angular Material et les navigateurs signalés.

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

Évaluation

Stack technique
angular, css, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

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