Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MenuUnstyled] Fix keyboard accessibility of menu items #33145

Merged
merged 3 commits into from Jun 23, 2022

Conversation

michaldudak
Copy link
Member

Fixed being unable to select a menuItem by a keyboard when its root component was overridden.
Now, when focusManagement of a Listbox is set to 'DOM', it lets the listbox item to handle the keyboard events and doesn't call preventDefault when space or enter are pressed.

Fixes #31796

@michaldudak michaldudak added bug 🐛 Something doesn't work component: menu This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base labels Jun 14, 2022
@mui-bot
Copy link

mui-bot commented Jun 14, 2022

Details of bundle changes

Generated by 🚫 dangerJS against 5c2ab97

@siriwatknp
Copy link
Member

@michaldudak Would it be possible to add a test for this?

@siriwatknp siriwatknp mentioned this pull request Jun 15, 2022
1 task
@michaldudak
Copy link
Member Author

Not specifically for being able to activate links using a keyboard, as this is not testable AFAIK.
I guess I could create a test that verifies if preventDefault is called in various cases instead.

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Awesome

@michaldudak michaldudak merged commit cb74465 into mui:master Jun 23, 2022
@michaldudak michaldudak deleted the menuitem-keyboard-events branch June 23, 2022 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: menu This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MenuItem] Cannot enter on link element
3 participants