-
Notifications
You must be signed in to change notification settings - Fork 6.8k
bug(cdk/menu): not possible to update active focus item #31370
Copy link
Copy link
Closed
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: cdk/menu
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 uses FocusManager to navigate through menu items howerever focuskeymanager is not exposed to public to programatically set different item as active one.
Although cdkMenuItem has focus method it only allows to focus specific menu item and doesn't set the active item in focusmanager accordingly.
Reproduction
StackBlitz link: https://stackblitz.com/edit/4a2okv3p?file=src%2Fexample%2Fcdk-menu-inline-example.ts
Steps to reproduce:
- Go to given StackBlitz link
- Observe 2nd item is focused
- Hit Arrow Down
- Observe focus shifts to first item on the list instead of 3rd
Expected Behavior
focus should go to next item when pressing arrow down.
one possible solution is to provide api setActiveMenuItem on cdkmenu
Actual Behavior
focus resets back to first item.
Environment
- Angular: 20
- CDK/Material: 20
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: cdk/menu