New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taphold event fired while scrolling on Blackberry Playbook #1524

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

Comments

Projects
None yet
7 participants
@kpozin
Contributor

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.

@toddparker

This comment has been minimized.

Show comment
Hide comment
@toddparker

toddparker Apr 28, 2011

Contributor

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?

Contributor

toddparker commented Apr 28, 2011

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

This comment has been minimized.

Show comment
Hide comment
@kpozin

kpozin Apr 28, 2011

Contributor

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.

Contributor

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.

@toddparker

This comment has been minimized.

Show comment
Hide comment
@toddparker

toddparker Apr 28, 2011

Contributor

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

Contributor

toddparker commented Apr 28, 2011

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

@kpozin

This comment has been minimized.

Show comment
Hide comment
@kpozin

kpozin Apr 28, 2011

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@kpozin

kpozin Jul 29, 2011

Contributor

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.

Contributor

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.

@ghost ghost assigned jblas Aug 8, 2011

jasondscott added a commit to jasondscott/jquery-mobile that referenced this issue Jan 23, 2012

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 added a commit to jasondscott/jquery-mobile that referenced this issue Jan 24, 2012

gseguin added a commit that referenced this issue Jan 26, 2012

Merge pull request #3475 from jasondscott/issue_1524
Issue #1524 - Taphold event fired while scrolling on Blackberry Playbook
@jasondscott

This comment has been minimized.

Show comment
Hide comment
@jasondscott

jasondscott Jan 27, 2012

Contributor

Hey @gseguin Can you close this issue?

Contributor

jasondscott commented Jan 27, 2012

Hey @gseguin Can you close this issue?

@gseguin gseguin closed this Jan 27, 2012

@dpeacock

This comment has been minimized.

Show comment
Hide comment
@dpeacock

dpeacock Sep 19, 2012

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

dpeacock commented Sep 19, 2012

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

@viljoviitanen

This comment has been minimized.

Show comment
Hide comment
@viljoviitanen

viljoviitanen Mar 26, 2013

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
  }
  ....
}

viljoviitanen commented Mar 26, 2013

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