-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
-
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.
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"; ... }
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 5 -
🚀 1
Replies: 1 comment
-
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.
Beta Was this translation helpful? Give feedback.