Closed Sacret closed 2 years ago
@Sacret thank you very much for the issue and the example!
i am seeing the weirdness that you are describing and i am looking into it. If you have any ideas or thoughts please let me know.
I was about to release v7 tonight, but after looking at this and trying the v7 alpha and seeing the same issue i'm going to focus on uncovering what is happening. 🕵️
@Sacret Okay this threw me through a bit of a loop, but after some exploration and strategically placed debugger
's the issue arises when both trackTouch
and trackMouse
are utilized.
We are attaching the document
eventlisteners even if the swipe was started as a touch. So after a touch swipe happens the mousemove
and mouseup
event listener's are still attached and fire when you click outside the swipeable target. This "triggers" a new swipe based on the previous swipes eventData
🤦 .
Now that i know what is happening there are a few solutions and clean ups we can do:
eventData
after a swipe "ends"mousemove
and mouseup
event listenersThank you thank you again @Sacret ! 🎉
@Sacret This will be fixed in v7 and is currently fixed and working correctly with v7.0.0-alpha.3
.
Check out the updated sandbox example:
@hartzis thank you as well for the explanation and fix. I really appreciate it!
Fixed with v7.0.0 release
Describe the bug I have a swipeable area with the
onSwipedLeft
andonSwipedRight
handlers. For some reason theonSwipedRight
event is firing if I click outside this area.Steps or Sandbox to reproduce
Steps to reproduce:
onSwipedRight
handler firesExpected behavior
onSwipedRight
should not be firing if you click the buttonDevice/Browser Google Chrome 100.0.4896.88 (64-bit) (for desktop browser the bug is reproducing only in mobile device mode, for example iPhone XR) or Chrome for Android 98.0.4758.101; Android 10; Mi 9 Lite Build/QKQ1.190828.002
Additional context If you click on the swipeable area between step 1 and 2 the bug does not reproduce.