Taphold event fired while scrolling on Blackberry Playbook #1524

kpozin opened this Issue Apr 28, 2011 · 8 comments


None yet

7 participants

kpozin commented Apr 28, 2011

On the latest version of the Playbook, jQuery Mobile often fires the taphold event while the user is touch-scrolling the screen. There should be some sort of mutex added to prevent this from happening.

Not sure if this is also an issue on other devices.


Just confirming - this is with the latest build (post-4.1)? Can you post a simple JS Bin or JS Fiddle demo page here that I can test on our PlayBook?

kpozin commented Apr 28, 2011

Thanks for looking into this, Todd. Here's a simple example: http://jsbin.com/oruhu4/

My proposed solution would be to bind to scroll (i.e. the native event) when a tap event starts. In the scroll handler, calculate scroll speed by comparing time and scroll offset since the last event, and if it's greater than some threshold, call clearTapHandlers(). The threshold would allow us to distinguish intentional scrolling from the jitter that happens when a user tries to hold a finger still to trigger the taphold event.


Thanks for your help, we'll take a look.

kpozin commented Apr 28, 2011

Some further notes, now that I've read through most of the relevant code.
handleTouchMove(event) determines whether scrolling occurred based on $.vmouse.moveDistanceThreshold = 10.
On the Playbook, the scroll event gets fired quite often, so even when scrolling quickly, the distance between scroll events is often less than 10 pixels.
As I mentioned above, speed rather than distance should be used in order to accommodate varying scroll event frequencies.

(Sorry about the accidental close!)

@kpozin kpozin closed this Apr 28, 2011
@kpozin kpozin reopened this Apr 28, 2011
kpozin commented Jul 29, 2011

In case anyone else has encountered this issue, here's a temporary fix that you can put into your code: https://gist.github.com/1113949

This eliminates most, but not all, unintended tapholds on the Playbook.

You can then check for $.mobile.isScrolling() in your taphold handlers, and not handle the event if the value is true.

@toddparker, it might be possible to adapt this code and incorporate it into jQuery Mobile.

@jblas jblas was assigned Aug 8, 2011
@jasondscott jasondscott added a commit to jasondscott/jquery-mobile that referenced this issue Jan 23, 2012
@jasondscott jasondscott Issue #1524 - Taphold event fired while scrolling on Blackberry Playbook
Cause: The vmousecancel event was not being fired for 'this'.

How Fixed: Bound vmousecancel event to document instead of 'this'.

How Tested: Ran the example provided with the issue
(http://jsbin.com/oruhu4/) with this change on BlackBerry Playbook v2.0
and iPad iOS 5.0.1
@jasondscott jasondscott added a commit to jasondscott/jquery-mobile that referenced this issue Jan 24, 2012
@jasondscott jasondscott Issue #1524 - Fixing style - Missing white space a215d4c

Hey @gseguin Can you close this issue?

@gseguin gseguin closed this Jan 27, 2012

This behavior still appears to occur on the Playbook with the latest JQuery Mobile (1.1.1 and 1.2.0-rc1).


This is also an issue with jquery mobile 1.3.0, with IE10 on a windows 8 tablet.

My workaround is almost the same that was suggested above, except it's a bit simpler:

var scrolling
$(document).ready(function () {
  $(window).scrollstart(function() {
  $(window).scrollstop(function() {
//then in the taphold callback function
function mycallback() {
  if (scrolling) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment