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
New way of detecting touch #650
Conversation
@@ -119,7 +119,7 @@ | |||
mouse.grab(); | |||
message("Display initialized"); | |||
|
|||
if ('ontouchstart' in document.documentElement) { | |||
if (document.ontouchstart' !== undefined) { | |||
message("Touch device detected"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extraneous single-quote maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops
Are you confident this will work on other (older) touch devices too? |
Well, there is actually no perfect solution here. Every way of detecting touch will have false positives and true negatives. As far I've seen this is the same as our existing detection with the exception of the chrome development touch emulation. |
Needs rebase to match with new file structure. |
Moves detection to Util and fixes so that touch is properly detected on MS Surface and touch emulation in Chrome.
Rebased and combined with the changes proposed by #613 I will manually test the following:
I feel that if these platforms don't show any false positives or any true negatives, I'm satisfied. If you feel that something important is left out from these tests, feel free to test it yourself. |
In addition to the tests above I also tested
All works fine EXCEPT for Firefox on a Microsoft Surface tablet. It has a touch screen but I can't, after much research, find any way to detect it. I believe we will have to live with this for now. The problem is mitigated by the fact that the Microsoft Surface tablets have a UI button in the start-bar for bringing up the virtual keyboard. As a summary, this new way of detecting touch does not seem to add any false positives and adds proper detection in the following cases:
|
This is necessary to detect touch emulation in chrome. Unless anyone knows of any problems with this, I will merge soon.