Opened 5 years ago

Closed 5 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:

  1. navigator.pointerEnabled is not anymore part of the Pointer Events specification [3].
  2. 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

[3] Pointer Events W3C Editor's Draft

Change History (21)

comment:1 Changed 5 years ago by Sebastien Pereira

Cc: Patrick Ruzand cjolif added

comment:2 Changed 5 years ago by Sebastien Pereira

Keywords: touch pointer events added
Owner: set to Sebastien Pereira
Status: newassigned

comment:3 Changed 5 years ago by Sebastien Pereira

Version: 1.9.3

comment:4 Changed 5 years ago by Adrian Vasiliu

Cc: Adrian Vasiliu added

comment:5 Changed 5 years ago by Patrick Ruzand

Milestone: tbd1.10

comment:7 Changed 5 years ago by Patrick Ruzand

Cc: Eric Durocher added

comment:8 Changed 5 years ago by Bill Keese <bill@…>

Resolution: fixed
Status: assignedclosed

In b25b080d6fb0e1b9e64ba48e303d207614f80ada/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:9 Changed 5 years ago by Bill Keese <bill@…>

In 2dcb4e325792caca5bd4ee053a8d7e390c619fff/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:10 Changed 5 years ago by Patrick Ruzand <pruzand@…>

In 184f71630051e64b864024b703df17f6d7f23507/dojox:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:11 Changed 5 years ago by bill

Resolution: fixed
Status: closedreopened

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 5 years ago by Bill Keese <bill@…>

Resolution: fixed
Status: reopenedclosed

In f73dd454bdfce56069fd1072fb6d8d6438ccf2d8/dojo:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:13 Changed 5 years ago by Bill Keese <bill@…>

In 9bde2f924856aaccbd62500b62ad310c016c6692/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:14 Changed 5 years ago by Sebastien Brunot

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.
Last edited 5 years ago by Sebastien Brunot (previous) (diff)

comment:15 Changed 5 years ago by Sebastien Brunot

Resolution: fixed
Status: closedreopened

comment:16 Changed 5 years ago by bill

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:17 Changed 5 years ago by bill

#18019 is a duplicate of this ticket.

comment:18 Changed 5 years ago by Sebastien Pereira

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 in reply to:  16 Changed 5 years ago by Sebastien Pereira

Priority: undecidedhigh
Type: taskdefect
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 5 years ago by Sebastien Pereira

c2f382cd194f147582e03c01dc41463eb978fd4a fixes has(touch) that caused #18019.

comment:21 Changed 5 years ago by bill

Resolution: fixed
Status: reopenedclosed
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: defectenhancement

This is fixed, right? Marking as enhancement so we remember to doc this in the release notes.

Note: See TracTickets for help on using tickets.