-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Framework: hasTouch() considered harmful #1479
Comments
Hi @nylen — cleaning up older issues in a bug scrub. Did this get traction? Do you want more opinions or discussion? If not, we'd like to close it. |
I don't think this should be closed - it's an outstanding issue with the current codebase. |
Who's going to work on it? Can we add it to a milestone? CC @mtias The problem with just leaving it is it'll be stale very quickly and never get addressed. |
No action in 5 months still. Will close at next bug scrub if it's not addressed. |
This is very much a still standing issue 👍 |
I've opened an issue for #9977 (comment): #9981 |
Closing as #9981 is fixed |
We have a "touch detect" library and use it in a few places. I've used it before, but I won't be anymore, and I recommend that we remove it entirely.
It's not really possible to reliably detect a touch device. You can detect the touch events APIs, but browsers have a history of implementing and activating these APIs on devices that would be considered "non-touch".
Also, there are lots of "hybrid" devices like the Surface family and other laptops that support both touch and mouse/keyboard as methods of interaction. The user can dynamically change between these methods, which is not possible to detect ahead of time.
For a longer, but excellent, writeup: You Can't Detect a Touchscreen
Modernizr (where we originally got our
touchDetect
code) has since changed the name of this check fromModernizr.touch
toModernizr.touchevents
, and added a ton of warnings about its use: Modernizr/Modernizr#548,feature-detects/touchevents.js
.Similarly, our own library code says:
Finally, we've had multiple issues with this in the past. To start:
hasTouch
for the media modalThe text was updated successfully, but these errors were encountered: