Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

137
Visualizações
Angular Material AutoComplete gives different isOpen behavior after upgrade

The functionality required:

There is an input box with a MatAutoComplete attached to it. When in focus, the autocomplete panel opens and shows the options; the user then uses arrow keys to activate an option and press Enter to select it. Then after selection, the autocomplete panel closes and in the next Enter, it saves it.

The way I was handling it was (Angular 8):

  1. User focuses on input, panel opens automatically
  2. User selects the option by pressing Enter
  3. The Enter event is - If Panel isOpen: Do not do anything; else: Save Input
  4. So when the user pressed enter on the option: isOpen was true before the panel closes automatically.
  5. But the next time the user presses Enter, isOpen is false and the input is saved.

Then I upgraded to Angular 11:

The Enter event function which checks for isOpen always returns false (It closes the panel 1st and then returns isOpen value) This results in input being saved with just one enter (not good). I event tried preventDefault to no avail.

Any suggestions or solutions will be appreciated!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda