MatAutocomplete panel does not close when the parent input changes focus programmatically.
- 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 adding host listener for keyboard navigation to other elements, the auto complete panel does not close.
### Reproduction
StackBlitz link: https://stackblitz.com/edit/angular-14-material-fbxecy?file=src%2Fauto-complete%2Fauto-complete.component.html
Steps to reproduce:
1. Click in the "Number" input.
2. Press Ctrl+DownArrow.
3. Observe that focus moves to the text area input without closing the panel.
### Expected Behavior
After the focus of the parent input moves to another element (either by click() or blur()), the panel should be closed.
### Actual Behavior
After moving focus from the parent input by using element.focus() the auto complete panel keeps visible until a click action takes place.
### Environment
- Angular: 14
- CDK/Material:
- Browser(s): Edge
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
Beitragsleitfaden
Rechercherichtung
Öffnen Sie die verknüpfte StackBlitz-Reproduktion und untersuchen Sie src/auto-complete/auto-complete.component.html. Verfolgen Sie anschließend die MatAutocomplete-Fokusbehandlung für programmatische Fokusänderungen. Reproduzieren Sie den Ctrl+DownArrow-Ablauf und überprüfen Sie, dass das Verschieben des Fokus mit element.focus(), click() oder blur() das Panel wie erwartet schließt.
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