vue3-touch-events
vue3-touch-events copied to clipboard
v-touch:tap gets triggered even if mousedown/touchstart happens outside of the element in a weird scenario
There's a weird bug I have noticed, that under a certain circunstance the :tap
method gets triggered when it should not.
(There's an option related to this issue called tapTolerance
)
How is it happening?
Let's call the following flow as "Flow 1"
- Mousedown any part of the screen without doing it over the element of interest.
- Without releasing the mousedown, go over the element of interest and release the mousedown over the element.
- The
:tap
event gets triggered
This always happens, until I trigger the tapTolerance
condition over the element.
What do I mean with triggering the tapTolerance
condition?
Lets say I left the tapTolerance
to it's defaults of 10px
, if I do the following:
And let's call the following flow as "Flow 2"
- Mouse down over the element of interest
- Move the cursor more than
10px
- The
:tap
event does not get triggered
No matter how many times I repeat the Flow 1 steps, I always get the :tap
event triggered, when it shouldn't because I didn't start the click/touch over the element of interest.
But as soon as I do the Flow 2 steps once, Flow 1 no longers triggers :tap
event. This should be the desired behavior all the time.