Skip to content
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

Mouse emulation on touch device doubles the pointer events #2

Open
mpizenberg opened this issue Nov 14, 2017 · 1 comment
Open

Mouse emulation on touch device doubles the pointer events #2

mpizenberg opened this issue Nov 14, 2017 · 1 comment

Comments

@mpizenberg
Copy link
Owner

On touch devices, a "tap" on the touch surface will generate an emulated mouse click few millisecond later. This behavior is to reduce the potential non usability of websites that do not take into account touch interactions.

In our case, this is an issue since it doubles the number of pointer events generated. An example of this problem is testable with this JS fiddle : https://jsfiddle.net/6aw0z9hL/1/
Try a "tap" with either a touch device (smartphone/tablet) or firefox in responsive mode with touch activated.

I read that event.preventDefault() should prevent this emulated mouse event from happening but it is not the case in the example above.

mpizenberg added a commit that referenced this issue Nov 16, 2017
This prevents issue #2 from happening on smartphone but does not fix it.
Indeed, we do not want to prevent mouse events on devices that support
both touch and mouses (touch screen on laptop for example).
@robx
Copy link
Contributor

robx commented Dec 5, 2017

For reference, jQuery's pointer events polyfill seems to do some manual deduplication here: https://github.com/jquery/PEP/blob/master/src/touch.js#L11

So it seems likely that the emulated mouse event can't easily be disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants