Opened 6 years ago
Closed 6 years ago
#17810 closed enhancement (fixed)
revise has("touch"), add has("touch-events"), has("pointer-events"), has("MSPointer")
Reported by: | Sebastien Pereira | Owned by: | Sebastien Pereira |
---|---|---|---|
Priority: | high | Milestone: | 1.10 |
Component: | General | Version: | 1.10.0-beta1 |
Keywords: | touch, pointer, events | Cc: | Patrick Ruzand, cjolif, Adrian Vasiliu, bill, Eric Durocher |
Blocked By: | Blocking: |
Description
Note: this ticket may impact dojo, dijit and dojox modules.
Pointer Events are being developed and integrated on Chrome [1] and Firefox [2]. Until supported release of Chrome/FF implement those features, feature detection in dojo should not be a problem. However we should prepare for changes:
navigator.pointerEnabled
is not anymore part of the Pointer Events specification [3].navigator.maxTouchPoints
will be available on non-IE
Dojo has("touch")
condition to return true is "ontouchstart" in document || window.navigator.msMaxTouchPoints > 0
.
The meaning of has("touch") should be clarified as "user agent is running on a device with a touchscreen" and condition window.navigator.maxTouchPoints > 0
should be added to has("touch")
definition.
Also, we should introduce new has
flags to avoid confusion and replace current tests based on navigator.pointerEnabled
and navigator.MSPointerEnabled
has("touch") ===> "ontouchstart" in document || window.navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0 has("touch-events") ===> "ontouchstart" in document has("pointer-events") ===> navigator.maxTouchPoints || navigator.msMaxTouchPoints has("MSPointer") ===> navigator.msMaxTouchPoints
With these flags we should be able to cover all use cases where has("touch")/navigator.pointerEnabled/navigator.msPointerEnabled are used in dojo, dijit and dojox modules.
=== [1] Chromium Issue 196799: Support for Pointer Events Issue 258459: touch-action CSS property
[2] Firefox Bug 822898 - Implement pointer events Bug 795567 - Implement touch-action CSS property for Pointer Events
Change History (21)
comment:1 Changed 6 years ago by
Cc: | Patrick Ruzand cjolif added |
---|
comment:2 Changed 6 years ago by
Keywords: | touch pointer events added |
---|---|
Owner: | set to Sebastien Pereira |
Status: | new → assigned |
comment:3 Changed 6 years ago by
Version: | 1.9.3 |
---|
comment:4 Changed 6 years ago by
Cc: | Adrian Vasiliu added |
---|
comment:5 Changed 6 years ago by
Milestone: | tbd → 1.10 |
---|
comment:6 Changed 6 years ago by
Cc: | bill added |
---|
comment:7 Changed 6 years ago by
Cc: | Eric Durocher added |
---|
comment:8 Changed 6 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:11 Changed 6 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
seb - I'm seeing test_touch.html failures on IE10, see https://www.dropbox.com/s/myijmnynmmcr5qt/Screenshot%202014-05-10%2006.59.46.gif, hopefully just a problem w/the test needing to be updated.
comment:12 Changed 6 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:14 Changed 6 years ago by
The current fix, as discussed with spereira, has a side effect: because Chrome 35 (at least on mac OS X) do implement maxTouchPoints in the navigator object but do not implements pointer events, dojo/touch is broken on this browser: it listens to pointer events that are never emitted.
You can test that with the two following dojo mobile tests, that are failing on Google Chrome 35:
- test_Overlay.html: click the popup button, and then click the "Done" button of the overlay: nothing happens (expected: the overlay is closed)
- test_ScrollableView-v-ah-af.html: you cannot scroll the view, nor start a transition by clicking a list item.
comment:15 Changed 6 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:16 follow-up: 19 Changed 6 years ago by
Thanks for tracking that down. As described in #18019, it also breaks dropdowns in dijit (see for example dijit/tests/_HasDropDown.html).
I guess the test should be "onpointerdown" in document
, similar to the check for touch-events: "ontouchstart" in document
?
comment:18 Changed 6 years ago by
Chrome Desktop M35 introduce a partial support of the pointer events specification: it supports the
touch-ction
CSS property ("touchAction" in document.body.style
is true) and also defines "maxTouchPoints" in navigator
, but it doesn't support the events (pointerdown...), so we need another way to detect the support for pointer events.
Chrome Mobile M35 is not impacted, but Chrome M36 plan to add the same partial support (1).
Firefox is not impacted yet, but also plan to provide pointer-event support. An experimental support is available since FF 29 behind flags dom.w3c_pointer_events.enabled
and layout.css.touch_action.enabled
(2).
(1) https://code.google.com/p/chromium/issues/detail?id=372357 (2) https://bugzilla.mozilla.org/show_bug.cgi?id=960316
comment:19 Changed 6 years ago by
Priority: | undecided → high |
---|---|
Type: | task → defect |
Version: | → 1.10.0-beta1 |
Replying to bill:
I guess the test should be
"onpointerdown" in document
, similar to the check for touch-events:"ontouchstart" in document
?
Yes, according the from the Pointer Events spec we can do that (1). I pushed the change in 36a44e063bfd1fde48de1944fdcf89a316dddc9a
(2) http://www.w3.org/TR/pointerevents/#extensions-to-the-globaleventhandlers-interface
comment:20 Changed 6 years ago by
c2f382cd194f147582e03c01dc41463eb978fd4a fixes has(touch) that caused #18019.
comment:21 Changed 6 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Summary: | Review and investigate has("touch") and feature detection such as navigator.pointerEnabled. → revise has("touch"), add has("touch-events"), has("pointer-events"), has("MSPointer") |
Type: | defect → enhancement |
This is fixed, right? Marking as enhancement so we remember to doc this in the release notes.
Pull requests Dojo: https://github.com/dojo/dojo/pull/84 Dijit: https://github.com/dojo/dijit/pull/47 Dojox: https://github.com/dojo/dojox/pull/103 Calendar: https://github.com/damiengarbarino/dojo-calendar/pull/95