Skip to content

Instantly share code, notes, and snippets.

@azaek
Created October 13, 2023 08:37
Show Gist options
  • Save azaek/774158fe37d0808934a7e2c486464298 to your computer and use it in GitHub Desktop.
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
<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