react-draggable
react-draggable copied to clipboard
Not possible to listen to click events inside a `Draggable` on Mobile
trafficstars
Hi,
we are using react-draggable and have a link inside a draggable which should be clickable.
<Draggable
axis="x"
>
<Link>I should be clickable</Link>
</Draggable>
On a non-touch device this works fine as the click event fires normally. However, on touch devices the click event is not fired at all, which is unfortunate. The line of code responsible for this, seems to be this one:
https://github.com/react-grid-layout/react-draggable/blob/44a8c6ed103ec6c0a4dda5faf7f8ebca16f9b325/lib/DraggableCore.js#L295
touchstart event are cancelled there, resulting in the click never firing.
Since this line seems to be in place to prevent scrolling on touch devices, would a possible solution be to cancel touchmove instead?
Another solution may be to cancel the touchstart event higher up