ten1seven / what-input

A global utility for tracking the current input method (mouse/pointer, keyboard or touch).
https://ten1seven.github.io/what-input
MIT License
1.35k stars 89 forks source link

Touch with Laptop #10

Closed mgifford closed 8 years ago

mgifford commented 9 years ago

I just tested http://ten1seven.github.io/what-input/ with my laptop. It's an Ubuntu machine.

Unfortunately, it identified it as a mouse.

It did work fine on my Android device. Not sure where the problem lies.

ten1seven commented 9 years ago

Can you be more specific? What it a touch-screen laptop and a touch was identified as a mouse?

mgifford commented 9 years ago

It is a System 76 touchscreen laptop with Ubuntu 14.04. And yes, when I touched the screen, it identified it as a mouse. Very different than my phone.

ten1seven commented 9 years ago

And what browser are you using on your laptop?

mgifford commented 9 years ago

Tried with FF (39.0) & Chrome (Version 43.0.2357.132 (64-bit)). Chrome doesn't seem to work at all well on the form elements. They aren't highlighted at all.

ten1seven commented 9 years ago

Thanks! I'm going to see how far I can get with this on a Parallels VM. I may enlist your help since, at least in my world, your setup isn't very common.

mgifford commented 9 years ago

Agreed.. At the moment Windows dominates the touch screen laptop world.

alanontheweb commented 8 years ago

Is this supposed to work for hybrids on Windows? I had someone test the demo on his Surface Pro and he told me that it detected his touch as "mouse". I was really hoping it would.

ten1seven commented 8 years ago

@alanontheweb I don't have a Surface handy for testing but I did test with a touchscreen laptop running Windows 8 and that behaved as predicted, switching between touch and mouse depending on what's being used. It could be how I'm handling pointer events, which have good implementation in IE but my touchscreen laptop was likely a limited sample. I think I can get the demo tested by a colleague as well to see what results they get. When you have a chance, can you let me know the spec on that Surface (hardware generation and OS version)?

alanontheweb commented 8 years ago

I will! Thanks for actively supporting the project :) I think alternative scripts focus on figuring out the device, but I like the approach you're taking. I just hope it can be made to be more consistent with further testing.

alanontheweb commented 8 years ago

Okay, I've done some testing. This were on 2 Surface 3s running Windows 10. It seems to work great in Chrome. In IE11 and Edge, they work well too, but sometimes when touching the screen, it flickers to 'mouse' for a split second. I noticed that if I tap multiple times really fast in IE, the script incorrectly switches to mouse. Not sure if that's a real problem in average use though.

The one that doesn't work AT ALL is Firefox (the latest stable version). It registers everything as a mouse input. Any thoughts if this can be fixed?

ten1seven commented 8 years ago

Thanks for the testing!

According to this, touch events are currently disabled in desktop Firefox unless in Metro mode.

alanontheweb commented 8 years ago

Ack, dang, so close to a perfect script! Firefox is so lame now :( Hahah.

alanontheweb commented 8 years ago

I haven't looked into how whatinput works, but is there any sort of trickery that can be accomplished by combining this polyfill that would result in cross-browser support?

https://github.com/jquery/PEP

ten1seven commented 8 years ago

It already detects for pointer events and handles them as touch or mouse depending on which one it is: https://github.com/ten1seven/what-input/blob/master/what-input.js#L70

patrickhlauke commented 8 years ago

@mgifford coming in late, but: do those browsers actually recognise touch under ubuntu? i.e. if using http://patrickhlauke.github.io/touch/tracker/multi-touch-tracker-pointer-hud.html [edit: it seems this actually bombs in Firefox due to lack of current support for canvas ellipse method - see https://github.com/patrickhlauke/touch/issues/13] are touches identified as touch, or mouse? if the latter, the problem is down to the OS/browser and whether or not they understand/expose touch and/or have touch actually enabled (as noted, even on Windows, many browsers on desktop suppress their touch events by default because of sites that do naive "does it support touch" sniffs and then assume that's the only input modality, making them impossible to use with keyboard/mouse)

patrickhlauke commented 8 years ago

Just to confirm (from some quick testing) that in Windows 10 using Surface 2 touch is correctly recognised in Chrome, while Firefox still doesn't actually recognise/fire touch at all (it's disabled by default for site compat reasons)

patrickhlauke commented 8 years ago

Sorry, to expand: there's nothing that can be done at this script's level if the OS/browser themselves don't expose/recognise touch interfaces (which is the case for instance for Firefox on touchscreen laptops/desktops). Likely the same issue under Ubuntu (suspect that it's not exposing the fact it has a touchscreen to the browsers). As such, the issue here can probably be closed.

ten1seven commented 8 years ago

Thanks @patrickhlauke for digging in and testing. I concur. Going to close this.