Skip to content

bug(MatAutoComplete): optionActivated is invoked with the first item when ESC is pressed #23430

Closed
@conner-fallone

Description

@conner-fallone

Reproduction

https://stackblitz.com/edit/angular-nfavep?file=src%2Fapp%2Fautocomplete-auto-active-first-option-example.html

Steps to reproduce:

  1. Click in the auto complete to toggle the dropdown
  2. Arrow down to item "Two" or "Three"
  3. Press the ESC key and notice that optionActivated fires for item "One" (see log statements)

Expected Behavior

The optionActivated option should not be invoked when the ESC key is pressed to close the auto complete

Actual Behavior

The optionActivated option is invoked when it shouldn't be since the the auto complete is closing

Environment

  • Angular: 11
  • CDK/Material: 11
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/autocomplete

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions