Created
October 13, 2023 08:37
-
-
Save azaek/774158fe37d0808934a7e2c486464298 to your computer and use it in GitHub Desktop.
Radix Dropdown Menu issues with touch and pointer events f.e. scrolling in phone causes it to trigger open
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<DropdownMenu.Trigger asChild | |
onPointerUp={(event) => { | |
if (event.pointerType === "touch" || event.pointerType === "pen") { | |
setOpenMenu(true); | |
} | |
}} | |
onPointerDown={(event) => { | |
if (event.pointerType === "touch" || event.pointerType === "pen") { | |
event.preventDefault(); | |
} | |
}} | |
> | |
{component} | |
</DropdownMenu.Trigger> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment