material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Menu][base] MenuItem as a link does not work

Open siriwatknp opened this issue 2 years ago • 5 comments

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:

  1. 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 avatar Apr 24 '23 05:04 siriwatknp

@siriwatknp on opening the sandbox link, i'm seeing something went wrong screen Screenshot 2023-04-24 at 11 32 37 AM

sai6855 avatar Apr 24 '23 06:04 sai6855

@siriwatknp on opening the sandbox link, i'm seeing something went wrong screen Screenshot 2023-04-24 at 11 32 37 AM

Can you try again? https://codesandbox.io/s/still-platform-rh966j?file=/demo.tsx

siriwatknp avatar Apr 24 '23 06:04 siriwatknp

working now

sai6855 avatar Apr 24 '23 06:04 sai6855

Thanks! I'll see what I can do about it.

michaldudak avatar Apr 26 '23 08:04 michaldudak

@michaldudak are you working on this? If not, could you please assign this to me?

nicolas-ot avatar May 03 '23 09:05 nicolas-ot

@michaldudak reasking my question last week: are you working on this? If not, could you please assign this to me?

nicolas-ot avatar May 09 '23 12:05 nicolas-ot

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.

michaldudak avatar May 09 '23 14:05 michaldudak

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

nicolas-ot avatar May 11 '23 10:05 nicolas-ot