-
Notifications
You must be signed in to change notification settings - Fork 2
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
API detection is incomplete #1
Comments
See https://patrickhlauke.github.io/touch/tests/touch-feature-detect.html in a recent stable Chrome build on a device without a touchscreen - |
@patrickhlauke thanks for info about the Essentially what I’m looking to know is if the device hardware has a touch screen and that I can access the interactions with the touch screen via the Touch Events API - and the legacy detection is how I'm currently determining this. What’s the best way to detect this? |
there's no one true way to detect presence of a touchscreen...at least not by just relying on touch events API stuff. paradoxically, it may be good to use pointer events and CSS 4 interaction media features as additional indicators for the presence of a touchscreen, combined with a test for the presence of touch events. so, altogether, checking |
Thanks for the info. It seems like, at least for my purposes, the legacy For Firefox, I just ran into a bug in The Pointer Events detection isn't very helpful for me now because knowing the device has touch screen does nothing unless I can access the interactions via the Touch Events API (I build with React which doesn't support Pointer Events). |
Worth noting that the more modern way to detect the presence of touch event API would be to test for
window.TouchEvent
. At the same time worth noting that, at least as far as Chrome is concerned, this will return true even if there is no actual touchscreen at browser startup - which makes sense if the intent is indeed to test the presence of the API / the capability. See https://lists.w3.org/Archives/Public/public-touchevents/2016Dec/0007.html for further infoThe text was updated successfully, but these errors were encountered: