Open bolonio opened 1 month ago
There's a possible "workaround" that might work (from the side of the consumer), but unfortunately it will only work for mouse users, it breaks the keyboard navigation. I'm still investigating if there's a nicer workaround for both cases.
Bug report
The Radix Dropdown Menu component opens on
onPointerDown
(which means as soon as a mouse navigation user presses the triggering element of the dropdown menu), but there is not available a function on the up-event, or a mechanism to abort the function before completion or to undo the function after completion. You can take a look at the Understanding SC 2.5.2: Pointer Cancellation (Level A) article for more information.Current behavior
Expected behavior
You can see the behaviour in the W3C Menu Button Pattern or in the W3C Menu Bar Pattern
or moving the mouse outside of the dropdown menu triggering and content should cancel the
onPointerDown
function.Reproducible example
Radix Dropdown Menu component
Suggested solution
Change the opening of the dropdown menu to
onPointerUp
oronClick
instead of usingonPointerDown
.Additional context
Here there are some examples of Radix components which meet the criteria, such as:
onPointerUp
)onPointerUp
)onPointerUp
)Note: It might be related to https://github.com/radix-ui/primitives/issues/2700 (not 100% sure about it though)
Your environment