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

[Menu] Trying to achieve accessibility with Menu, MenuList, MenuItem #45206

Open
noobDev31 opened this issue Feb 4, 2025 · 2 comments
Open
Assignees
Labels
component: menu This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@noobDev31
Copy link

noobDev31 commented Feb 4, 2025

Summary

Open the Menu and then clicking on arrow down key, I am not able to move to the 2nd MenuList and access the Menu Items there.
Below is reproduction of the issue involving Menu, Menu List and Menu Item -

https://stackblitz.com/edit/react-djf5hpms?file=Demo.tsx

I have multiple ways -

  1. Make MenuList as div by passing
    MenuListProps={{ component: 'div' }} to the Menu component so that I don't have ul inside a ul

  2. Wrapping each MenuList with li's

But they don't seem to work

Examples

https://stackblitz.com/edit/react-djf5hpms?file=Demo.tsx

Motivation

Trying to make our components accessible

Search keywords: accessiblity

@noobDev31 noobDev31 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 4, 2025
@mj12albert mj12albert added component: menu This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material labels Feb 5, 2025
@mj12albert
Copy link
Member

@noobDev31 In your sandbox, is there a specific reason you need to nest or even have multiple MenuList components?

MenuList provides roving focus as well: https://github.com/mui/material-ui/blob/master/packages/mui-material/src/MenuList/MenuList.js#L145-L211

So when several of them are arranged like that, keyboard navigation will behave incorrectly

@mj12albert mj12albert added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 5, 2025
@mj12albert mj12albert changed the title Trying to achieve accessibility with MUI Menu, Menu List, Menu Item [Menu] Trying to achieve accessibility with Menu, MenuList, MenuItem Feb 5, 2025
@noobDev31
Copy link
Author

noobDev31 commented Feb 5, 2025

@noobDev31 In your sandbox, is there a specific reason you need to nest or even have multiple MenuList components?

MenuList provides roving focus as well: https://github.com/mui/material-ui/blob/master/packages/mui-material/src/MenuList/MenuList.js#L145-L211

So when several of them are arranged like that, keyboard navigation will behave incorrectly

@mj12albert yes we want to have multiple ListSubheader like below -

Image
so that's the reason I am trying to make it work like this

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants