Description
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 opening a dialog that contains an input making use of matAutocomplete
, the autocomplete will stop propagation of escape keydown events (and, looking at the code, possibly other keys/combinations) even when the autocomplete panel is closed.
I would agree that these key presses should not be propagated if the panel is open and options are shown. However, I don't see a reason why they shouldn't be propagated if there is no open panel.
In our case, if the user opened the dialog by accident or decided not to fill out the form displayed in the dialog, they would need to press escape twice to close the dialog again. This is rather confusing.
Code I suspect to be "at fault"
Reproduction
https://stackblitz.com/edit/components-issue-nddpxk?file=src/app/dialog/dialog.component.html
Steps to reproduce:
- Open dialog in which an input with
[matAutocomplete]
is focused upon opening - Without entering anything in the input, press escape
- The first escape press does nothing, the second one closes the dialog
Expected Behavior
If the autocomplete panel is closed, keydown events should still be propagated, including escape.
Actual Behavior
Regardless of whether the autocomplete panel is open or closed, the escape keydown event is stopped from propagating.
Environment
- Angular:
- 15.0.0
- 15.1.0
- CDK/Material:
- 14.2.1
- 15.0.0
- Browser(s):
- Firefox Developer Edition 110.0b4
- Chrome 109.0.5414.87
- Operating System (e.g. Windows, macOS, Ubuntu): macOS 12.6.2