Navigation Menu

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

New way of detecting touch #650

Merged
merged 1 commit into from Oct 19, 2016
Merged

New way of detecting touch #650

merged 1 commit into from Oct 19, 2016

Conversation

samhed
Copy link
Member

@samhed samhed commented Sep 1, 2016

This is necessary to detect touch emulation in chrome. Unless anyone knows of any problems with this, I will merge soon.

@@ -119,7 +119,7 @@
mouse.grab();
message("Display initialized");

if ('ontouchstart' in document.documentElement) {
if (document.ontouchstart' !== undefined) {
message("Touch device detected");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extraneous single-quote maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops

@kanaka
Copy link
Member

kanaka commented Sep 1, 2016

Are you confident this will work on other (older) touch devices too?

@samhed
Copy link
Member Author

samhed commented Sep 2, 2016

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.

@DirectXMan12
Copy link
Member

Needs rebase to match with new file structure.

@DirectXMan12 DirectXMan12 added this to the v0.7.0 milestone Sep 16, 2016
Moves detection to Util and fixes so that touch is properly detected on
MS Surface and touch emulation in Chrome.
@samhed
Copy link
Member Author

samhed commented Oct 14, 2016

Rebased and combined with the changes proposed by #613

I will manually test the following:

  • Fedora 24, Chrome
  • Fedora 24, Firefox
  • Android 7.0, Chrome
  • Android 7.0, Firefox
  • OS X 11, Chrome
  • OS X 11, Firefox
  • OS X 11, Safari
  • iOS 10, Chrome
  • iOS 10, Firefox
  • iOS 10, Safari
  • Windows 10, Chrome
  • Windows 10, Firefox
  • Windows 10, IE 11
  • Windows 10, Edge
  • Windows 10 touch device, Chrome
  • Windows 10 touch device, Firefox
  • Windows 10 touch device, IE 11
  • Windows 10 touch device, Edge
  • Chromebook with touch

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.

@samhed
Copy link
Member Author

samhed commented Oct 19, 2016

In addition to the tests above I also tested

  • Android 4.3, Chrome
  • Android 4.3, Firefox
  • Android 6.0, Chrome
  • Android 6.0, Firefox
  • iOS 9, Chrome
  • iOS 9, Firefox
  • iOS 9, Safari

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:

  • Chromebook
  • Windows 10 touch device, IE 11
  • Windows 10 touch device, Edge

@samhed samhed merged commit 5826ab6 into master Oct 19, 2016
@samhed samhed deleted the touchdetect branch October 19, 2016 22:18
@samhed samhed added the feature label May 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants