angular / angular/components

MatAutocomplete panel does not close when the parent input changes focus programmatically.

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

Descrizione

### 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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Apri la riproduzione StackBlitz collegata e ispeziona src/auto-complete/auto-complete.component.html. Traccia quindi la gestione del focus di MatAutocomplete per le modifiche programmatiche del focus. Riproduci il flusso Ctrl+DownArrow e verifica che lo spostamento del focus con element.focus(), click() o blur() chiuda il pannello come previsto.

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
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.