Skip to content

Conversation

@mnajdova
Copy link
Member

@mnajdova mnajdova commented Dec 25, 2025

Fixes #3595

The issue is that https://github.com/mui/base-ui/blob/master/packages/react/src/menu/item/useMenuItem.ts#L75 fires on Windows, but not on MacOS. Apperantly on MacOS the operating system intercepts the event to show the context menu.

I added a check at the beginning of the handler to ignore the code if it comes from right-click, this way we can have coherent behavior between Windows and other OSs.


There is another difference that I noticed between Windows and MacOS, on Windows the context menu opens on mouse up, while on MacOs it opens on mouse down.

@mnajdova mnajdova added type: bug It doesn't behave as expected. component: context menu Changes related to the context menu component. platform: windows labels Dec 25, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 25, 2025

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@3612
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@3612
    

commit: 7bf5489

@mui-bot
Copy link

mui-bot commented Dec 25, 2025

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+2B(0.00%) ▼-5B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@netlify
Copy link

netlify bot commented Dec 25, 2025

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 7bf5489
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/694d360e13d5850008d38ea7
😎 Deploy Preview https://deploy-preview-3612--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@mnajdova
Copy link
Member Author

@atomiks can you provide some reproduction for what the failing test is doing? See https://app.circleci.com/pipelines/github/mui/base-ui/18503/workflows/13724f2e-ee8b-435d-94da-e7b422ebdde0/jobs/194806

I am asking because on MacOS, the mouse up does not even fire, while on Windows the context menu opens on mouse up, so I don't understand when will this code run. I can't reproduce #3224 on this PR or master, so I am not sure what should the test capture.

@atomiks
Copy link
Contributor

atomiks commented Dec 28, 2025

@mnajdova it's for right-click down -> drag -> right-click up (release), which macOS's native context menu supports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: context menu Changes related to the context menu component. platform: windows type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[context menu] Context menu closes when right-clicking a menu item on Windows

3 participants