-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[material-ui][MenuItem] The href property is ignored #40098
Comments
@serhiiminin I thought we would have a demo for this, but you can achieve the markup in the APG example like this: <MenuItem role="none">
<Link role="menuitem" href="/profile">
Profile
</Link>
</MenuItem> Here's a working sandbox |
Hi @mj12albert Also, the docs says the following
It feels like MenuItem should support "href" property and do everything automagically 🤔 |
@serhiiminin MenuItem does accept the Ensure you provide the
Ye it's mentioned in the docs but this is due to the logic of the ButtonBase component, as explained here: #28335 (comment). So, should we close this issue? |
@ZeeshanTamboli thank you for the response. I think we can close the issue. Thank you! |
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example:
https://codesandbox.io/p/sandbox/morning-cache-zxmq6m?file=%2Fsrc%2FDemo.tsx%3A60%2C13
Steps:
Current behavior 😯
"href" property does turn a menu item into a link
Expected behavior 🤔
MenuItem is rendered as a link when providing "href" property
Context 🔦
I am building a navigation menu button
https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/examples/menu-button-links/
I want my MenuItems to be links
Also,
MenuItem
does not accept the "component" property, so I can't do this https://stackoverflow.com/a/64038036Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: