Skip to content

[MenuUnstyled] Fix keyboard accessibility of menu items#33145

Merged
michaldudak merged 3 commits intomui:masterfrom
michaldudak:menuitem-keyboard-events
Jun 23, 2022
Merged

[MenuUnstyled] Fix keyboard accessibility of menu items#33145
michaldudak merged 3 commits intomui:masterfrom
michaldudak:menuitem-keyboard-events

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 type: bug It doesn't behave as expected. scope: menu Changes related to the menu. package: @mui/base Specific to @mui/base (legacy). labels Jun 14, 2022
@michaldudak michaldudak requested a review from siriwatknp June 14, 2022 12:46
@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

package: @mui/base Specific to @mui/base (legacy). scope: menu Changes related to the menu. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MenuItem] Cannot enter on link element

3 participants