bug(mat-chip-option): selected CSS classes are not applied in a specific case
- Lenguaje dominante
- TypeScript
- Estrellas
- 25k
- Forks
- 6.8k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 91
Descripción
### 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 the selected property changes, there is a case where the selected CSS classes are not applied.
I have an application where we have a list of selectable teams and the possibility to filter them by gender (male or female). By default the 1st team is selected. On this app, we also want the selected team to be changed to the first matching the current filter if the currently selected team does not match the filter.
To illustrate the bug and show that the property that is passed to the mat-chip-option is indeed updated I have also set the disabled attribute with the same property as selected to show that this one works properly.
### Reproduction
StackBlitz link: https://stackblitz.com/~/github.com/FabienCH/mat-chip-option-selected
- When changing the gender filter (unselect male) without changing the selected team, the selected CSS classes are applied to the selected team (team 1 female).
- When changing the selected team by clicking on an option the selected CSS classes are applied.
Steps to reproduce:
1. Change the selected team by clicking on an option (click on a male team for example)
2. Change the gender filter (unselect male) => the selected CSS classes are not applied
You can see that the selected property of the option is true and the disabled CCS classes are applied
### Expected Behavior
The selected CSS classes should be applied.
### Actual Behavior
The selected CSS classes are not applied.
### Environment
- Angular: 20.1
- CDK/Material: 20.1
Guía de contribución
Línea de trabajo
Comienza ejecutando la reproducción vinculada de StackBlitz e inspecciona el comportamiento de mat-chip-option cuando el equipo seleccionado cambia después de filtrar por género. Compara las clases CSS selected y disabled durante ambos pasos de reproducción; se considera terminado cuando las clases CSS selected se aplican cuando la propiedad selected cambia mediante el filtrado, así como después de hacer clic en una opción.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- frontend
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100