Closed
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
Don't know
Description
When the menu trigger is pressed via clicking, the focus stays on trigger instead of going to the first menu item (or menu wrapper). It works as expected when the trigger is pressed via keyboard, and in mat-menu
.
Although arrow keys would still move focus to menu items, the biggest impact of this issue is that the menu won't close by Escape
, since it's the trigger that has the focus, not the overlay.
Reproduction
Steps to reproduce:
- Go to https://material.angular.io/cdk/menu/examples
- Click on the "Click me!" button in one of the last two examples ("Standalone Trigger" ones)
- Press
Escape
. It won't close the menu, as focus is still on the trigger, not the menu.
Expected Behavior
Menu should grab the focus, regardless of if trigger is pressed by mouse or keyboard.
Actual Behavior
Menu does not grab the focus, regardless of if trigger is pressed by mouse or keyboard. Focus remains on the trigger, if it's triggered by mouse.
Environment
- Angular: 15.2.0
- CDK/Material: 15.2.0
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS