material-ui
material-ui copied to clipboard
[Menu][base] MenuItem as a link does not work
Duplicates
- [X] I have searched the existing issues
Latest version
- [X] I have tested the latest version
Steps to reproduce 🕹
Link to live example: https://codesandbox.io/s/still-platform-rh966j?file=/demo.tsx
Steps:
- Click on the first menu item, it does not link to
/#test
Current behavior 😯
The link behavior is prevented.
Expected behavior 🤔
The link behavior should not be prevented.
Context 🔦
Found this bug from #36975, I was trying to create a navigation menu similar to https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-navigation/.
The useMenuItem uses useListItem which has event.preventDefault at this line https://github.com/mui/material-ui/blob/f3bf444da2fe9f8b2ad4f22179f34e3ba1ba90c5/packages/mui-base/src/useList/useListItem.ts#L73.
Your environment 🌎
npx @mui/envinfo
Don't forget to mention which browser you used.
Output from `npx @mui/envinfo` goes here.
@siriwatknp on opening the sandbox link, i'm seeing something went wrong screen

@siriwatknp on opening the sandbox link, i'm seeing something went wrong screen
Can you try again? https://codesandbox.io/s/still-platform-rh966j?file=/demo.tsx
working now
Thanks! I'll see what I can do about it.
@michaldudak are you working on this? If not, could you please assign this to me?
@michaldudak reasking my question last week: are you working on this? If not, could you please assign this to me?
Sorry, the notification must have slipped through the cracks. I have other things on my plate right now, so feel free to take a stab at it.
I believe this is a joy issue because the codesandbox uses Menu from Joy instead of Base (from title). I will also check BaseUI
edit: BaseUI also has the same bug