headlessui icon indicating copy to clipboard operation
headlessui copied to clipboard

A click initiated outside `DialogPanel` should be cancellable

Open benface opened this issue 1 year ago • 0 comments

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v2.2.0

What browser are you using?

Zen 😎

Reproduction URL

https://headlessui.com/react/dialog 😜

Describe your issue

When accidentally pressing down the left mouse button outside the DialogPanel element, there is currently no way to NOT close the dialog, even though it looks like there is because it only closes when the mouse button is released. IMO, this is akin to pressing the left mouse button when the cursor is on a <button> element, then moving the cursor away from it and releasing it; it would be considered a bug for the <button>'s onClick to be called in that scenario. So I really think that it should be possible to "cancel" the click outside by moving the cursor inside the DialogPanel and releasing it there.

benface avatar Nov 19 '24 19:11 benface