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

Framework: hasTouch() considered harmful #1479

Closed
nylen opened this issue Dec 10, 2015 · 7 comments
Closed

Framework: hasTouch() considered harmful #1479

nylen opened this issue Dec 10, 2015 · 7 comments

Comments

@nylen
Copy link
Contributor

nylen commented Dec 10, 2015

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 from Modernizr.touch to Modernizr.touchevents, and added a ton of warnings about its use: Modernizr/Modernizr#548, feature-detects/touchevents.js.

Similarly, our own library code says:

[This test] may not accurately detect a touch screen, but may be close enough depending on the use case.

Finally, we've had multiple issues with this in the past. To start:

@lancewillett
Copy link
Contributor

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.

@nylen
Copy link
Contributor Author

nylen commented Apr 9, 2016

I don't think this should be closed - it's an outstanding issue with the current codebase.

@lancewillett
Copy link
Contributor

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.

@lancewillett
Copy link
Contributor

No action in 5 months still. Will close at next bug scrub if it's not addressed.

@johnHackworth
Copy link
Contributor

This is very much a still standing issue 👍
#9977 (comment)

@tyxla
Copy link
Member

tyxla commented Dec 12, 2016

I've opened an issue for #9977 (comment): #9981

@alisterscott
Copy link
Contributor

Closing as #9981 is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants