Opened 8 years ago
Closed 8 years ago
#16569 closed defect (fixed)
[regression] has('touch') apparently reports 'false' on Surface or touch enabled Win8 devices running IE10
Reported by: | Paul Christopher | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.8.4 |
Component: | Core | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Description
Apparently
has.add("touch", "ontouchstart" in document);
returns 'false' on touch enabled devices running IE 10, see for MS Surface
and IE10 "modern UI" mode (i.e. the IE10 version run from the start screen not the desktop)
https://github.com/Modernizr/Modernizr/issues/753
Apparently you need to check the msMaxTouchPoints property to get a better guess, see
http://msdn.microsoft.com/en-us/library/ie/hh772144%28v=vs.85%29.aspx
and
http://blog.stevelydford.com/2012/03/detecting-touch-hardware-in-ie-10/
Thus
has.add("touch", "ontouchstart" in document || window.navigator.msMaxTouchPoints);
might fix the issue?
But I have not yet tested this since I don't yet have a touch-enabled Win8 device (Thus I have opened this ticket rather for community testing and validation since it could be a critical point in the near future). If you want to test this: It don't think you need a MS Surface tablet for this but a simple Laptop with a touch screen and Win8 (like the Lenovo ThinkPad X230 Convertible Tablet)?
Additional materials
- Modernizr's has('touch') test: http://modernizr.com/downloads/modernizr-latest.js
- Modernizr's test page for the has('touch') test: http://modernizr.github.com/Modernizr/touch.html
- The Modernizr.touch test only indicates (like Dojo's test?) if the browser supports touch events, which does not necessarily reflect a touchscreen device, see https://github.com/Modernizr/Modernizr/issues/548
Change History (12)
comment:1 Changed 8 years ago by
comment:2 Changed 8 years ago by
Milestone: | tbd → 1.8.4 |
---|---|
Priority: | undecided → high |
I don't have a Surface either; let's get this into 1.8.4 though. If no one has a Surface device we should just follow Microsoft's advice and add navigator.msMaxTouchPoints > 0 to the test (which is in dojo/has.js).
comment:3 Changed 8 years ago by
Bill, I think I have found a solution: Visual Studio for Win8 ships together with a "tablet simulator" for Windows store apps, see http://msdn.microsoft.com/library/windows/apps/hh441475.aspx
"ontouchstart" in document
gives me always false, even in the tablet simulator
"ontouchstart" in document || window.navigator.msMaxTouchPoints
gives me 0 on a normal computer and a number > 0 (in my case: 5) on a touch-enabled device ("the simulator").
comment:4 Changed 8 years ago by
So maybe the correct fix would use !! to convert the numbers to boolean values?
has.add("touch", "ontouchstart" in document || !!window.navigator.msMaxTouchPoints);
comment:5 Changed 8 years ago by
Owner: | set to bill |
---|---|
Status: | new → assigned |
Sure, that or window.navigator.msMaxTouchPoints > 0.
comment:8 Changed 8 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Summary: | has('touch') apparently reports 'false' on Surface or touch enabled Win8 devices running IE10 → [regression] has('touch') apparently reports 'false' on Surface or touch enabled Win8 devices running IE10 |
Starting in [30381] and [30382] in 1.8, it is no longer possible to interact with dijit Buttons with a physical keyboard in IE10 in Windows 8. This does not appear to affect IE10 on Windows 7.
To reproduce:
- In Win8 IE10, load http://archive.dojotoolkit.org/nightly/checkout/dijit/tests/form/robot/Button_a11y.html
- When the robot tabs to the Edit button and tries to open the menu, nothing happens.
You can also manually reproduce this in test_Button. It appears something is eating onKeyPress whenever you press enter or space. Curiously, pressing shift+enter or shift+space will open the menu.
comment:10 Changed 8 years ago by
OK, sure, [30381] and [30382] need to be coupled with [30397]. But after [30397] I can use ENTER or SPACE to open the "Edit!" drop down menu in test_Button.html on Windows8 / IE10 running against trunk. I'm not sure why it's not working for you. I tried the code in archive.dojotoolkit.org/nightly too.
comment:11 Changed 8 years ago by
PS: what does keyboard have to do with touch? If anything I would expect you to say that mouse is broken.
comment:12 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
This official post by Microsoft http://blogs.msdn.com/b/ie/archive/2012/07/12/ie10-user-agent-string-update.aspx also mentions
as the way to got to detect touch capabilites.
Very interesting: Even the IE10 user agent string indicates, whether you are running on a touch capable hardware (see blog post above):
IE10 on a machine without touch-capable hardware:
IE10 on a machine with touch-capable hardware:
(Notice the word "Touch" at the end of the second UA string.)
However that is only intersting for server-side sniffing, I guess. At least Microsoft says for client side detection, feature detection using navigator.msMaxTouchPoints should be used and not UA sniffing.