bug(autocomplete): reset input value doesn't update the selected option
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
#### Reproduction
When an autocomplete control is reset, the selected option still hold the `.mat-selected` class.
https://stackblitz.com/edit/angular-ufhza2
Steps to reproduce:
1) Open the autocomplete
2) Select an entry
3) Click reset
4) Open the autocomplete again

#### Expected Behavior
`mat-selected` class should be removed when autocomplete is empty
#### Environment
- Angular: `10.2.0`
- CDK/Material: `10.2.5`
Contributor guide
Research direction
Start by reproducing the behavior in the linked StackBlitz: select an autocomplete entry, reset the control, and reopen it. Trace the autocomplete selection and reset handling to find why the selected option retains the `mat-selected` class; done means the class is removed when the input is empty, with coverage for the reported steps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100