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

select doesn't work on touch screen laptop #27

Open
GoodGuyShinsuke opened this issue Dec 10, 2014 · 2 comments
Open

select doesn't work on touch screen laptop #27

GoodGuyShinsuke opened this issue Dec 10, 2014 · 2 comments

Comments

@GoodGuyShinsuke
Copy link

Hi guys,

I just came across this bug where the select doesn't work in the touch screen PC, using mouse.
I was debugging the code and found out:

select.js line:1378
touchDevice = 'ontouchstart' in document.documentElement;
clickEvent = touchDevice ? 'touchstart' : 'click';

If its touch screen, it registers clickEvent with "touchstart", and ignores the mouse click event.

Cheers

@lmeurs
Copy link

lmeurs commented Mar 24, 2015

For this reason it is strongly advised against testing touch support. Even when no touchscreen is connected, devices sometimes do support optional touchscreens and browser tests return true.

I wrote a small plugin that does not test browser support, but keeps track of event cycles. This way we can ask the plugin on mouse events like click and mouseleave if the event was fired by touch or mouse. See for more information http://stackoverflow.com/a/26145343/328272

@adam-lynch
Copy link

👍. From 2013 but as far as I know is still accurate: http://www.stucox.com/blog/you-cant-detect-a-touchscreen/

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

No branches or pull requests

3 participants