angular / angular/components

bug(mat-chip): mat-chip does not react to [selected] binding when the mat-chip-list also contains a formControl (e.g.) official autocomplete example

Aperta
#21,999 5 commenti 2 reazioni 0 assegnatari Vedi su GitHub
area: material/autocomplete area: material/chips P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### Reproduction

This example is copied directly from the official "Chips Autocomplete" example ([https://material.angular.io/components/chips/examples]). I have just stripped some of the unnecessary bits for a minimal example.

The example shows 3 copies of same mat-chip-list showing how mat-chips do not react to [selected] binding when a mat-input with either [formControl] or [matAutocomplete] bindings are included in the mat-chip-list.

All the existing chips should be selected in all copies. The only difference between the 3 is what bindings are included in the

https://components-issue-y2hda6.stackblitz.io

Steps to reproduce:
1. Create a mat-chip-list with mat-chips that have a [selected] binding (or just static flag set)
2. Add a with either [matAutocomplete] or [formControl]
3. The mat-chips no longer reflect their "selected" css styles (although appear to be internally in selected state)

#### Expected Behavior

For all chips to be selected in all copies

#### Actual Behavior

Presence of [formControl] or [matAutocomplete] prevents css styles being applied to selected chips

#### Environment

- Angular: 11.1.1
- All OS/Browser

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con la riproduzione StackBlitz collegata e confrontala con l'esempio ufficiale di Chips Autocomplete. Analizza il comportamento di mat-chip-list e mat-chip quando l'input utilizza [formControl] o [matAutocomplete]. Il lavoro è completato quando i chip esistenti applicano i propri stili CSS di selezione in tutti e tre i casi riprodotti.

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
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.