angular / angular/components

bug(matFormField): Form field state not being updated properly when input dynamically changes

オープン
#28,495 コメント 0 件 リアクション 0 件 担当者 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

version 14

### Description

When dynamically changing the input type of a form field, the label and error state of the for field is not properly reflected, the label will not float up and the form outline color will not be set. [See demo example](https://stackblitz.com/edit/nmqf81?file=src%2Fexample%2Fform-field-hint-example.html)

Confirmed that id used to work properly in version 14 [see demo working](https://stackblitz.com/edit/vaqmlj?file=src%2Fapp%2Fform-field-overview-example.ts,src%2Fapp%2Fform-field-overview-example.html)

### Reproduction

Steps to reproduce:
1. open [demo](https://stackblitz.com/edit/nmqf81?file=src%2Fexample%2Fform-field-hint-example.html)
2. toggle slider
3. click submit
4. see that label has not floated and form outline is not red
5. open v14 demo and see it working properly [stackblitz](https://stackblitz.com/edit/vaqmlj?file=src%2Fapp%2Fform-field-overview-example.ts,src%2Fapp%2Fform-field-overview-example.html)

### Expected Behavior

Form field should allow inputs to dynamically change

### Actual Behavior

Error state and label are not propely reflected

### Environment

- Angular: 17
- CDK/Material: 17

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

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

調査の方向性

リンクされた StackBlitz の再現コードから始め、Angular Material form-field の状態変化を追跡しながら、Angular 17 での動作を提供された version 14 のデモと比較します。動的な input-type の切り替えと submit フローを再現します。入力の変更後にラベルがフロートし、フォームのアウトラインがエラー状態を反映すれば完了です。

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

評価

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

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

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