I am making a mobile website that uses JavaScript touch events. Things work fine in iOS Safari and Chrome for Android, but the stock Android Browser (version 4.1.2) is giving me trouble.
During a touch process, the touchstart
and touchmove
events are called as expected. However, one of the actions performed by the touchmove
handler seems to trigger a premature touchcancel
event. (I'm not sure whether this is significant, but the action that triggers the touchcancel
is the modification of an SVG object's viewBox
attribute.) If I comment out this action, the touch process proceeds normally (i.e., completion of touchmove
through to touchend
).
All of my touch handlers call the preventDefault()
function, so the issue isn't the one that's described in this bug: https://code.google.com/p/android/issues/detail?id=19827.
I've read that there is a lot of inconsistency among browsers as to when touchcancel
is called. The stock Android browser is the only one that is problematic for me.
Is there a workaround out there? For example, is there away I can completely disable the touchcancel
event? Another idea I had was to have the touchcancel
handler programmatically trigger another touchstart
/touchmove
event, but I didn't get very far with that. Any ideas would be appreciated.