Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Preventing next click after scrolling #12

Open
iscy opened this Issue · 3 comments

3 participants

@iscy

On the iPhone:
1. Scroll on a page
2. Hit an element that has onClick() function
=> Nothing happens
3. Hit it again
=> Works

The function: _preventNextClick() is the root cause of this issue. I'm not sure why this function was introduced in the first place... but removing its call from onTouchMove fixes my issue. I think the handler should be removed from onTouchEnd().

@iscy

Here is a patch that fixes the issue by removing the prevent handler on onTouchEnd().

Index: web/touchscroll.js
===================================================================
--- web/touchscroll.js  (revision 5168)
+++ web/touchscroll.js  (working copy)
@@ -639,6 +639,8 @@
 
                                this.startFlick(flickVector, flickDuration);
                        }
+
+                       scroller.removeEventListener("click", preventHandler, true);
                }
 
                if(!(this.isAnimating())){
@@ -667,13 +669,15 @@
        _preventNextClick: function _preventNextClick(){
                var scroller = this.scrollers.container;
                scroller.style.webkitTapHighlightColor = "transparent";
-               scroller.addEventListener("click", function prevent(event){
-                       event.stopPropagation();
-                       this.removeEventListener("click", prevent, true);
-                       this.style.webkitTapHighlightColor = "";
-               }, true);
+               scroller.addEventListener("click", preventHandler, true);
        },
 
+       _preventHandler: function _preventHandler(event) {
+               event.stopPropagation();
+               scroller.removeEventListener("click", preventHandler, true);
+               scroller.style.webkitTapHighlightColor = "";
+       },
+
        isAnimating: function isAnimating(){
                var timeouts = this._animationTimeouts;
                var hasTimeouts = timeouts.e.length > 0 || timeouts.f.length > 0;
@davidaurelio

Thanks for the patch … this will be fixed with the rewrite, I just don’t have much time left to finish it at the moment.

@ruiquelhas

This is still happening (at least on Android phones), and I don't see that _preventNextClick function anywhere in the code, so I don't know how can I patch it. Any workaround for this? The project doesn't seem pretty active right now, but i'm hoping someone can answer me.

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.