angular / angular/components

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

オープン
#27,086 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る
area: material/form-field P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンクされている StackBlitz の再現を開いて 2 つの mat-form-fields を比較し、次に .mat-form-field の display ルールが inline-block から inline-flex に変更されたことを確認します。報告されている Angular Material のバージョンとブラウザーで、mat-label があるフィールドとないフィールドが垂直方向に揃うことを確認して、修正を検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, css, typescript
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。