angular / angular/components

bug(form-field): Updating input value via `effect`+`FormControl` doesn't trigger label position calculation

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

説明

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

When updating a `FormControl` value inside a signal `effect`, the `MatFormField` floating label does not reposition under `OnPush` change detection unless `ChangeDetectorRef.markForCheck()` is called manually.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/ujogbvgu?file=src%2Fexample%2Fform-field-overview-example.ts
Steps to reproduce:
1. Update input via `FormControl` + `effect`
2. Observe that label position does not update unless `ChangeDetectorRef.markForCheck()` is invoked explicitly.

### Expected Behavior

Using `signal`s and `effect`s, I expected not to have to call `ChangeDetectorRef.markForCheck()` for the label to float.

### Actual Behavior

The label did not float when the control's value was set.

### Environment

- Angular: 20.2.x
- CDK/Material: 20.2.x
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

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

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

調査の方向性

src/example/form-field-overview-example.ts の再現から始め、OnPush 変更検知の下で FormControl と effect を使用して StackBlitz の手順を実行します。MatFormField のラベル位置の更新を追跡し、ChangeDetectorRef.markForCheck() を手動で呼び出さなくても、control の値が変更された後にラベルがフロートすることを確認します。

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

評価

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

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

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