angular / angular/components

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

Offen
#31,600 4 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
area: material/chips P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Führe zunächst die verknüpfte StackBlitz-Reproduktion aus, insbesondere src/example/chips-form-control-example.html, und bestätige, dass FormControl nach Fokus und Blur dirty wird, ohne dass sich der Wert ändert. Verfolge die Verarbeitung von Blur und Wertänderungen durch mat-chip-grid und überprüfe anschließend, dass sich der dirty-Zustand nur ändert, wenn Chips hinzugefügt oder entfernt werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.