multiple touches: touchend event fired only when a touchmove occurs
- by dridri
I would like to add some multitouch features to my javascript application when it is accessed from an ios device (and maybe android later).
I want to provide a shiftkey-like functionality: the user may hold a button on the screen with one finger, and while this button is pressed, the behavior for a tap action on the rest of the screen is slightly different from the classic tap.
The problem i'm running into is that i do not receive any touchend event for the tapping finger unless a touchmove is fired for the first finger holding the shiftkey button.
Because the screen is very sensitive, touchmove events gets easily fired and in most cases everything works fine.
But when the user's finger is a bit too still, the tapping is not detected until the user moves his finger a bit.
This induces a variable 'delay' between the tapping and the action that occurs on the screen (the delay may vary and last a few seconds if the user is very calm).
My guess is that this delay will cause the user to tap again and thus fire the action a second time, which is something that i don't want !
You can test it here with your ipad/iphone : http://jsfiddle.net/jdeXH/8/
Try to make the body remain green for a few seconds by holding your finger very still on the cyan div while tapping on the red div.
Is this behavior to be expected ?
Is there some known workaround for the problem ?
I would have expected the touchend event to be fired right away when the finger is removed from the screen.
i tested this with iOS 5.1.1 (ipad1 and iphone4s)
edit: found a similar question Multitouch touchEvents not triggered as they should on Safari Mobile