react-draggable icon indicating copy to clipboard operation
react-draggable copied to clipboard

Is it possible to somehow detect whether a Draggable has been dropped over a specific element?

Open silentstormm opened this issue 4 years ago • 3 comments
trafficstars

I want to be able to delete or otherwise change a Draggable when it's dropped over another div, is that possible?

silentstormm avatar Jan 20 '21 19:01 silentstormm

If you put a display: hidden element over your drop area element with a higher z-index than the draggable element, you can have an onMouseUp event that listens for the drop and reads the current state of dragging item. That was my solution to implementing this, but there is almost certainly a better one out there somewhere. I can maybe write a demo when I'm not at work, if you'd like.

ewdaimonia avatar Apr 07 '21 20:04 ewdaimonia

@ewdaimonia onMouseUp solution works in desktop but not mobile. In mobile, onMouseUp fires when i click on the div element(drop area), but when I drag an element over it, onMouseUp does not fire

shanlau avatar Mar 18 '22 01:03 shanlau