angular / angular/components

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

Open
#32,228 1 comment 0 reactions 0 assignees View on GitHub
area: material/form-field forms P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
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

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

Contributor guide

Open the contributing guide

Research direction

Start with the reproduction in src/example/form-field-overview-example.ts and run the StackBlitz steps using FormControl and effect under OnPush change detection. Trace the MatFormField label-position update and verify that the label floats after the control value changes without manually calling ChangeDetectorRef.markForCheck().

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.