Prevent tap event from being fired when swiping in jquerymobile on android webview
Asked Answered
M

1

7

I have a Phonegap 3 app that uses jQuery Mobile 1.4 and Backbone.js.

In this app I use the 'swipeleft' and 'swiperight' events to show different parts of a form (swipes show previous/next div).

This works fine but my issue is that if I swipe with my finger on top of checkboxes, the checkbox receives the tap event before the swipe is fired so the checkbox state is changed.

I see this also with other widgets but the checkbox seemed enough to explain the issue.

I don't have the issue on chrome on a desktop computer nor with the new chrome webview in Kitkat but have the problem in Gingerbread and Jelly Bean (the older webkit webview).

I stop the propagation of the swipe event in the event-handling function, but since the "unwanted" tap is fired before, that has no much effect...

Is there something I can do to avoid the tap event being fired during a swipe in the Android webview?

Manatee answered 27/3, 2014 at 16:59 Comment(4)
Have you tried setting up your custom swipe events' using "touch" events? Moreover, if you scroll up/down with finger on such an element, does it receive a tap event?Hindorff
I haven't tried setting up my own swipe events, hopping I could make jquery mobile's work as I expected. When scrolling up/down checkboxes don't receive the tap (unless I swipe up/down and the screen can't scroll). JQM buttons receive the tap event also for swipe up/down on jelly bean but not on kit kat. Maybe should I make my div larger than the screen to have a little horizontal scroll during the swipe?Manatee
If it possible share the code what you tried...Untread
Have you tried using 'e.stopPropagation' to stop multiple events being fired?Pub
P
0

You could try e.stopPropagation to see if that stops your touch from being registered on both the swipe and the checkbox.

Pub answered 23/3, 2017 at 20:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.