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

Find a way to turn off touch controls on desktop browsers #39

Open
cykod opened this issue Apr 30, 2013 · 8 comments
Open

Find a way to turn off touch controls on desktop browsers #39

cykod opened this issue Apr 30, 2013 · 8 comments

Comments

@cykod
Copy link
Owner

cykod commented Apr 30, 2013

See G+ Discussion

@yckart
Copy link

yckart commented Apr 30, 2013

@yckart
Copy link

yckart commented Apr 30, 2013

+@janmyler A no brainer question, I have to ask for. Are maybe your webdeveloper-tools open and you just forgot to disable the touch emulation?

And if not, what is about testing for a viewport, maybe >= 1280?

@janmyler
Copy link

@yckart Nope, Dev-tools/Firebug closed, touch emulation disabled by default. Check out these screenshots:

Chrome Version 26.0.1410.64 m
image

Firefox 20.0.1
image

Opera 12.15
image

According to e.g. this link, it seems that Chrome and Firefox on Windows support touch events without touchscreen necessarily being connected/available.

Simple testing for viewport size imo won't work well if you think about retina devices or the new Nexus 10 tablet.

@cykod
Copy link
Owner Author

cykod commented May 1, 2013

For reference, http://modernizr.github.io/Modernizr/touch.html has a good list of links for the discussion on detection.

I'll see what Modernizr has reached as a consensus after I get a chance to dig through all of em...

@cykod
Copy link
Owner Author

cykod commented Jun 4, 2013

So there's no good solution for this still - the workaround I'm planning on putting in is this:

  1. By default, touch events are on if the browser supports them
  2. If the keyboard or mouse is used, touch is turned off (Q.touchDevice = false)
  3. If a touch event is triggered, touch is turned back on (Q.touchDevice = true)
  4. The input system will show and hide the touch controls appropriately and disable responding to touch events appropriately.

Anyone have any thoughts on this?

@janmyler
Copy link

janmyler commented Jun 4, 2013

This looks reasonable. In my project, I've used a workaround based on window.orientation detection, which is undefined in desktop browsers (at least as far as i know). Not sure if it makes sense, though.

@ghost ghost added question and removed question labels Jun 3, 2014
@fariazz
Copy link
Collaborator

fariazz commented Jun 24, 2014

An idea could be to add the ability to disable touch or mouse events globally, as I can't think of an alternative that will leave everybody happy. Then people can check for features, for browsers, OS, etc and enable/disable as per their own needs.

Something like:

//check for screen size or browser or OS or touchscreen present etc etc
Q.setup({disableTouchEvents: true});

//or for instance if I want to avoid mouse and touch events triggered at the same time in older Android versions:
Q.setup({disableMouseEvents: true}); 

What do you guys think?

@rabimba
Copy link

rabimba commented Sep 15, 2014

I just wanted to know is there a way to solve it in case I am sure my code only will work for touch based devices?
I still have the effect of double triggering when the code runs in a touch device (even with the Q.setup({disableMouseEvents: true}); enabled).
I can simulate that using Firefox's Responsive View and Touch simulation.

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

5 participants