Cannot stop event bubbling? #353
-
Hello. Everything works great except that the onDrag event gets registered both on my opened image and the gallery(as it can be navigated by dragging). Here is my code for the gestures:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I'm pretty sure the drag you're seeing on the image is the native drag and drop from the browser which you won't disable with Simplest solution would probably be to have the css But that's hard to assess without a sandbox: giving a minimal sandbox in your issues / questions simplifies answers drastically. Also, you can try upgrading to |
Beta Was this translation helpful? Give feedback.
I'm pretty sure the drag you're seeing on the image is the native drag and drop from the browser which you won't disable with
stopPropagation
. There's a few things you could do, like trying toevent.preventDefault()
(but witheventOptions.capture
set totrue
).Simplest solution would probably be to have the css
pointer-events: none
on your image element.But that's hard to assess without a sandbox: giving a minimal sandbox in your issues / questions simplifies answers drastically.
Also, you can try upgrading to
@use-gesture/react
which will release shortly (in that case, make sure your renamedomTarget
totarget
.