angular / angular/components

bug(mat-chip-grid): mat-chip-grid marks FormControl as dirty on blur without actual value changes

Aperta
#31,600 4 commenti 1 reazione 0 assegnatari Vedi su GitHub
area: material/chips P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

### 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 using mat-chip-grid bound to a FormControl, the control is marked as dirty when the user focuses on the input field and then blurs away, even when no chips are added or removed and the value remains unchanged.

### Reproduction

StackBlitz link: [https://stackblitz.com/edit/2za91ztq?file=src%2Fexample%2Fchips-form-control-example.html](https://stackblitz.com/edit/2za91ztq?file=src%2Fexample%2Fchips-form-control-example.html)
Steps to reproduce:
1. Click into the input field
2. Click away (blur) without typing anything or adding any chips
3. Check the FormControl's dirty state - it will be true even though no value changes occurred

### Expected Behavior

The FormControl should only become dirty when the actual value changes (chips added/removed), not merely from focus/blur interaction.

### Actual Behavior

The FormControl becomes dirty after focus/blur interaction even when no chips are added or removed and the value remains unchanged.

### Environment

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia eseguendo la riproduzione StackBlitz collegata, in particolare src/example/chips-form-control-example.html, e conferma che FormControl diventi dirty dopo il focus e il blur senza alcuna modifica al valore. Traccia la gestione del blur e delle modifiche al valore di mat-chip-grid, quindi verifica che lo stato dirty cambi solo quando vengono aggiunti o rimossi dei chip.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.