pukhalski / tap

1Kb library for easy unified handling of user interactions such as mouse, touch and pointer events.
https://github.com/pukhalski/tap/archive/master.zip
MIT License
527 stars 45 forks source link

Clicks don't work in Chrome on Windows 8 and Windows 10 laptops with touchscreens #35

Closed mcat closed 9 years ago

mcat commented 9 years ago

I have seen this issue affect Chrome running on windows laptops that have touchscreen displays. The problem seems to be happening because of a change Chrome made to how touch events are handled.

Older versions of Chrome

'ontouchstart' in document.documentElement == false

Newer versions of Chrome

'ontouchstart' in document.documentElement == true

It might make sense to also check for the device orientation property or add a check of some other sort to handle this kind of situation.

// Chrome on a Microsoft Surface
typeof window.orientation == "undefined"

// Chrome on an iPad
typeof window.orientation == "landscape"