Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Is it possible to have FastClick work with webkit-overflow-scrolling? #42

Closed
ProcuraIsaac opened this issue Dec 10, 2012 · 9 comments
Closed

Comments

@ProcuraIsaac
Copy link

FastClick works very well, but when paired with webkit-overflow-scrolling which does the iOS scrolling momentum, the clicks are registered as the elements scroll by.

It would be nice for fast click to wait until the scrolling is finished or stop the scrolling when the user clicks.

Is there a way around this?

@th507
Copy link

th507 commented Dec 13, 2012

I think I could reproduce this scenario. See the following gist.

https://gist.github.com/4277995

@ProcuraIsaac
Copy link
Author

That demonstrates it perfectly. I've added a fiddle to show it based on th507 scenario. Just run this on an iOS device.

http://jsfiddle.net/2mguL/embedded/result/

Ideally, the first click would stop the animation. Then the user could click again to have the event registered.

@netpro2k
Copy link

netpro2k commented Jan 3, 2013

I notice that fastclick also causes elements with -webkit-overflow-scrolling: touch to jump scroll position intermittently as the user is scrolling. As you scroll you will notice the scroll position momentarily jump to a different spot, then snap back. This is somewhat more noticeable in the simulator, but also very noticeable on a real device.

You can see this in the jsfiddle posted above (direct link works better with viewport http://fiddle.jshell.net/2mguL/1/show/light/ )

@noteflight
Copy link

I'm seeing the same as netpro2k with the intermittent jump scroll. I didn't realize it was fastclick until I saw his post.

Interestingly the jumping doesn't happen if your finger is in contact with the screen while scrolling, only during inertial "scroll-by" motion.

@ghost ghost assigned mattcg Jan 4, 2013
@mattcg
Copy link
Contributor

mattcg commented Jan 4, 2013

Thank you for commenting and sorry there's been no update to this up till now. @th507 thank you for the gist; @ProcuraIsaac and @netpro2k thanks for the jsfiddle links - these are all very helpful.

I'm looking into this now.

mattcg added a commit that referenced this issue Jan 6, 2013
@mattcg
Copy link
Contributor

mattcg commented Jan 6, 2013

I think there are issues with changing the document contents during touchstart and touchmove events. From the Handling Events chapter of the Safari Web Content Guide:

Also, if the contents of the page changes on the mousemove event, no subsequent events in the sequence are sent. > This behavior allows the user to tap in the new content.

If you see the version of the test case I committed, I'm logging the debug messages to the console instead of writing them to the DOM. I can't reproduce the issue after doing this.

The only problem is that in the click callback, event.target is the element that would have been clicked on had the layer not scrolled at all.

@mattcg mattcg closed this as completed Jan 9, 2013
@matthew-andrews
Copy link
Contributor

Sorry @mattcg, I see this issue on your test case on iOS 6 / iPhone 4S.

@mattcg
Copy link
Contributor

mattcg commented Jan 13, 2013

Bizarre. It seems to behave to differently on the iPhone. My fault for only testing on iPad. Thanks for the heads up.

@mattcg mattcg reopened this Jan 13, 2013
mattcg added a commit that referenced this issue Jan 14, 2013
mattcg added a commit that referenced this issue Jan 14, 2013
…scroll on a layer made scrollable using -webkit-overflow-scrolling: touch (fixes issue #42)
@mattcg
Copy link
Contributor

mattcg commented Jan 14, 2013

Added a non-trivial workaround for this issue.

@mattcg mattcg closed this as completed Jan 14, 2013
mkai added a commit to mkai/fastclick that referenced this issue May 29, 2013
… re-fixes ftlabs#42)

Starting from 0.5.1 (first version to include ftlabs#57 fix), the bug fixed by ftlabs#42 reappeared: tapping on a currently scrolling container with -webkit-overflow-scrolling: touch sends a click on the underlying element (iOS 6); the expected behavior on iOS would be to just stop scrolling and not fire a click.

I haven't had much time to read through and understand the code (so the change may have side effects) but it restores the behavior of 0.5.0. So please consider this a bug report and adjust as needed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants