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

FastClick clicks on incorrect element if using iOS 6 and an active CSS transition or scroll fling #57

Closed
rowanbeentje opened this issue Jan 20, 2013 · 1 comment

Comments

@rowanbeentje
Copy link
Contributor

iOS 6 appears to have introduced a bug where the event.target element for input events is incorrect if the input was within an area that is being actively scrolled or CSS transformed. The event.target supplied by the browser isn't the element targeted by the input event; instead, it is the element that was at that position before the scroll/transition started.

This means that FastClick currently can click an element other than the intended element if it is within a parent that is being transitioned or is being scrolled.

(This is the underlying cause of Issue #42, although it may still be desirable not to send clicks when an element is scrolling.)

Further investigation seems to find that document.elementFromPoint can be used as a workaround as it gives the correct coordinates, but only reliably if it is called after event.targetElement, which seems to trigger an update of some kind after it's used. I've put a reduced testcase showing the odd behaviour up at http://beent.je/ios-targetelement-bug.html .

(Appears to still be present in iOS 6.1b4, so reported to Apple as rdar://13048589 )

mattcg pushed a commit that referenced this issue Jan 20, 2013
Work around incorrect element detection on iOS 6 in transitioning/scrolling layers (fixes #57). Thank you @rowanbeentje!
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.
@CristyTarantino
Copy link

Hi, I still have this problem when I save the page as home Screen App on my IOS devices.

vogdb added a commit to vogdb/fastclick that referenced this issue Dec 16, 2014
vogdb added a commit to vogdb/fastclick that referenced this issue Dec 16, 2014
Adjust the comment too.
vogdb added a commit to vogdb/fastclick that referenced this issue Jan 6, 2015
rowanbeentje added a commit that referenced this issue Jan 8, 2015
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

2 participants