Skip to content

Conversation

@chuganzy
Copy link
Contributor

@chuganzy chuganzy commented Dec 27, 2025

This PR adds a pressMode option to MenuTrigger.

Currently, Menu opens on mousedown, which allows users to drag directly to select a menu item. This is a nice and intentional interaction design, however, there are cases where this behavior is not suitable.

https://codesandbox.io/p/sandbox/z2jwsl

For example, when the element wrapping the trigger is draggable, it can be necessary to distinguish between a drag gesture and a menu interaction. In such cases, opening the menu on click rather than mousedown provides more appropriate behavior.

There is a related discussion in Radix:
radix-ui/primitives#2867

At the moment, this behavior can be implemented using onOpenChange / preventBaseUIHandler, but I thought it would be beneficial to support this use case directly in Base UI via an explicit option.

Please note that this PR will conflict with #3631. I will address it as needed.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 27, 2025

  • vite-css-base-ui-example

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

commit: 81ab430

@netlify
Copy link

netlify bot commented Dec 27, 2025

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 81ab430
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69527e2446d29300080f5c61
😎 Deploy Preview https://deploy-preview-3634--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.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Dec 28, 2025
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Dec 28, 2025
@oliviertassinari oliviertassinari added the component: menu Changes related to the menu component. label Dec 28, 2025
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Dec 29, 2025
# Conflicts:
#	packages/react/src/menu/trigger/MenuTrigger.tsx
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Dec 29, 2025
@mnajdova
Copy link
Member

mnajdova commented Jan 8, 2026

Can we for starter create a demo for this? To see how it looks in user-land and then decide if we want to have it as a feature directly in the component.

@chuganzy
Copy link
Contributor Author

chuganzy commented Jan 8, 2026

@mnajdova Thanks for taking a look! Sure, I can add a demo later. In the meantime, the CodeSandbox I shared already includes this. Although it is very rough, please refer to the "AFTER" section to see how it looks.

https://codesandbox.io/p/sandbox/z2jwsl

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

Labels

component: menu Changes related to the menu component.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants