Skip to content
This repository

Taphold event fired while scrolling on Blackberry Playbook #1524

Closed
kpozin opened this Issue April 28, 2011 · 8 comments

7 participants

Konstantin Pozin Kin Blas Ghislain Seguin Todd Parker Jason Scott dpeacock Viljo Viitanen
Konstantin Pozin

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.

Todd Parker

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?

Konstantin Pozin

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.

Todd Parker

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

Konstantin Pozin

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!)

Konstantin Pozin kpozin closed this April 28, 2011
Konstantin Pozin kpozin reopened this April 28, 2011
Konstantin Pozin
kpozin commented July 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.

Jason Scott jasondscott referenced this issue from a commit in jasondscott/jquery-mobile January 23, 2012
Jason Scott 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
92cf8d6
Jason Scott jasondscott referenced this issue from a commit in jasondscott/jquery-mobile January 23, 2012
Jason Scott Issue #1524 - Fixing style - Missing white space a215d4c
Jason Scott

Hey @gseguin Can you close this issue?

Ghislain Seguin gseguin closed this January 27, 2012
dpeacock

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

Viljo Viitanen

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() {
    scrolling=1
  })
  $(window).scrollstop(function() {
    scrolling=0
  })
}
//then in the taphold callback function
function mycallback() {
  if (scrolling) {
    return
  }
  ....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.