angular / angular/components

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

Ouverte
#31,600 4 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
area: material/chips P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
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 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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par exécuter la reproduction StackBlitz liée, en particulier src/example/chips-form-control-example.html, et confirmez que FormControl devient dirty après le focus et le blur sans changement de valeur. Suivez la gestion du blur et des changements de valeur de mat-chip-grid, puis vérifiez que l’état dirty ne change que lorsque des chips sont ajoutées ou supprimées.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.