Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Open Menu on mouseDown is breaking my UI #3714

mrcoles started this conversation in Ideas
Discussion options

I have a component in my UI that is both a menu and a draggable handle. Via mouseDown, I can grab it and move it, but if I instead click it, it opens a headlessui-react Menu.

Screenshot 2025年04月29日 at 1 36 29 PM

With the changes in @headlessui/react@2.2.2, specifically https://github.com/tailwindlabs/headlessui/pull/3689/files, the described functionality no longer works. The new mouseDown handler prevents my drag event handlers from triggering and I can only drag-and-drop when the menu is open.

I can get around this by running v2.2.1, but it’d be nice if I could specify whether it opens via 'click' or 'mouseDown' — and this would help other folks in my position too. FWIW, this feels like a breaking change, but IDK the policy being followed for versioning.

Proposal: add a new prop to MenuButton that allows specifying "click" or "mouseDown" as the trigger action. Potentially called something like: "action" or "trigger" or "openVia":

type MenuButtonProps = {
 trigger?: "click" | "mouseDown";
 ...
}
You must be logged in to vote

Replies: 1 comment

Comment options

This affects Combobox and Listbox as well.
A bigger problem is, that scrolling with your thumb on mobile devices will open the menus, which is not the best user experience to say the least. On the very least, pointer events should be handled differently, but I'd also vote for an option to choose the activation route.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /