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
Modernizr.touch detects touch events not touch devices #548
Comments
Yes, yes we should. Caniuse.com says Firefox 9+ supports touch but our test says otherwise when comparing to caniuse.com results. |
I think there is already way too much code around that expects |
I like dave's proposal. We tried capturing firefox touch in the see also jquery's upcoming blog post. |
Yes, I am afraid there are dark days ahead when it comes to apps handling touch events. The Webkit model would have been fine with me but it seems unlikely to gain a W3C blessing now. We can blame Apple's foot-dragging for this fragmentation. |
Yep this will be good to breakout touch into a plugin since it'll get huge testing for all variants. I'm pretty sure caniuse.com is wrong when it says firefox supports touch I have been poking around fennec and it doesn't support touch and they deprecated their |
ref #448 - I agree with the second point of optimizing the layout with media queries. Any sufficiently small screen can be handled with those. But in any case, windows phones currently don't send any events whatsoever (not even MSPointerEvents, they are slated for later versions), so you would need to detect that and render e.g. clickable controls vs swipeable ones. So for the current breed of windows phones, "touch" being true is valid in that the input method is a touch one and you need bigger manipulation controls for the user to hit. Then again, "touch" being false is valid in that the browser doesn't send any meaningful information whatsoever on the user's touch input. |
So there is
I think media queries tackle the second, for now... but so shall we just focus on touch event models? |
I agree that's a good strategy. Having Modernirz.touch return the applicable touch event model, and null/false if no touch event model is present should be enough cue to add non-touch manipulable controls on the page. |
Modernizr.touch // 'apple'
Modernizr.touch // 'pointer'
Modernizr.touch // false How about that? |
Should that be Do we have an idea how people are using |
@dmethvin yeah very good point that's how a lot of people would be using it. Not sure how we could handle it, the docs clearly state that it will return true in situtations where it's not a touchscreen device but does support touch. |
related tickets:
|
Related: http://blogs.msdn.com/b/ie/archive/2012/07/12/ie10-user-agent-string-update.aspx includes msft's proposed feature detect |
Yikes, this is too complicated for me. Props to you all. |
Related: http://code.google.com/p/chromium/issues/detail?id=152149 worth reading:
|
Confirmation that the Chrome team added support for pointer and hover media queries to webkit and enabled Chromium to appropriately enable them when it discovers a touch screen. It's either now (or very soon) available in desktop Chrome (Windows 8 in particular), and Chrome for Android. It's worth pointing out some gotchas:
To avoid confusion, I expect us to deprecate |
As for pointer/hover media queries.. each WebKit port needs to enable them individually-- the embedding environment needs to inform webkit what hardware the device has.. As such, it's possible the next releases of Blackberry, Nokia, iOS, and other webkit ports may not have these media queries enabled yet. If you have friends there, make sure they know you want them. :) |
So would |
Modernizr.touchevents would be true if either w3c or pointer were and then the more detailed one would indicate which model(s) is/are coarsepointer probably needs its own detect, maybe named that On Mon, Jan 7, 2013 at 5:23 PM, Ryan Seddon notifications@github.comwrote:
|
Thanks for these updates @paulirish. Does it really make sense for a Wouldn't simply Hopefully Kinect-style motion sensing input devices would fire PointerEvents too, but by definition don't involve touching anything! Also, My opinion would be that Modernizr should stick to detecting static browser support for PointerEvents and TouchEvents, while media queries can be used to determine, dynamically, whether or not a certain input device capability is present. So no need for Encouraging this pattern would (eventually) mean browsers no longer have to enable/disable touch-related APIs at runtime based on the input devices connected, and would encourage developers to consider input modes as a dynamic feature, like we already do for screen size. I love the idea of opening a web page on a tablet at home, using a mouse & keyboard with it, unplugging it to head out the door and the UI automatically switching to a touch-friendly variant. |
I like everything you just said. On Tue, Jan 8, 2013 at 12:33 AM, Stu Cox notifications@github.com wrote:
|
🍰 Pointer choices should just be considered part of a responsive design. |
@stucox well said and I agree with everything. 🤘 |
I agree with everything @stucox suggested as well. |
Lets you draw with touches. There's also a manifest.webapp for open web apps (such as for Firefox OS). Modernizr is used for detecting whether the device supports touches, but this is _not_ 100% reliable, yet: Modernizr/Modernizr#548 Currently, the points are 15px off on the Y axis.
Modernizr.touch changes, as per Modernizr#548
Modernizr.touch changes, as per Modernizr#548
We can you if(Modernizr.pointerevents) {// handler for point event} to check if user touch on screen of Surface? |
So how to detect touch devices with Javascript? |
|
IE Mobile e.g. doesnt expose webkit touch events but is a touch device..
what exactly does
Modernizr.touch
imply? We should agree so we can document it.The text was updated successfully, but these errors were encountered: