Quintus
Quintus copied to clipboard
Find a way to turn off touch controls on desktop browsers
See G+ Discussion
Just to be complete: https://plus.google.com/110275767335437137994/posts/JjGeyS22CPV
+@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?
@yckart Nope, Dev-tools/Firebug closed, touch emulation disabled by default. Check out these screenshots:
Chrome Version 26.0.1410.64 m
Firefox 20.0.1
Opera 12.15
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.
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...
So there's no good solution for this still - the workaround I'm planning on putting in is this:
- By default, touch events are on if the browser supports them
- If the keyboard or mouse is used, touch is turned off (Q.touchDevice = false)
- If a touch event is triggered, touch is turned back on (Q.touchDevice = true)
- The input system will show and hide the touch controls appropriately and disable responding to touch events appropriately.
Anyone have any thoughts on this?
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.
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?
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.