Quintus icon indicating copy to clipboard operation
Quintus copied to clipboard

Find a way to turn off touch controls on desktop browsers

Open cykod opened this issue 11 years ago • 8 comments

See G+ Discussion

cykod avatar Apr 30 '13 01:04 cykod

Just to be complete: https://plus.google.com/110275767335437137994/posts/JjGeyS22CPV

yckart avatar Apr 30 '13 02:04 yckart

+@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 avatar Apr 30 '13 02:04 yckart

@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.

janmyler avatar Apr 30 '13 06:04 janmyler

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 avatar May 01 '13 15:05 cykod

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?

cykod avatar Jun 04 '13 02:06 cykod

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.

janmyler avatar Jun 04 '13 09:06 janmyler

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?

fariazz avatar Jun 24 '14 23:06 fariazz

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.

rabimba avatar Sep 15 '14 20:09 rabimba