-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
cdkMenu keyboard navigation doesn't skip disabled options like mat-menu does. cdkMenu loses menu item focus when navigating to a disabled menu item, while mat-menu focuses the next available menu item that is not disabled.
Reproduction
CDK behaviour: https://stackblitz.com/edit/jqrnmquv-y12cuztc?file=src%2Fexample%2Fcdk-menu-standalone-menu-example.html
Steps to reproduce:
- Open menu
- Press down arrow key - "Refresh" menu item is selected
- Press down arrow key again - "Help" menu item is selected and "Settings" is skipped because it is disabled
- Press up arrow key - no menu item is selected.
- Press up arrow key again - "Refresh" menu item is selected
From this point on, it takes two button presses to select a menu item before or after the disabled "Settings" menu item. This behaviour is even more buggy when the first item in the menu list is disabled.
Mat Menu behaviour: https://stackblitz.com/edit/6hkqcjif?file=src%2Fexample%2Fmenu-icons-example.html
Steps to reproduce:
- Open menu
- Press down arrow key - "Disable alerts" menu item is selected. For some reason, "Redial" gets skipped, so there could be another bug here, but it's not the behaviour that I wanted to focus on in this discussion.
- Press up arrow key - "Check voice mail" is skipped because it is disabled, and "Redial" is selected.
Expected Behavior
I would like the disabled menu items to be skipped completely in cdk like they are in mat-menu.
Actual Behavior
cdkMenu loses menu item focus when navigating to a disabled menu item
Environment
- Angular: ^19.2.0
- CDK/Material: ^19.2.0
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS