From 7a88278b79818b0ac9ab454c8c6ebff511fe7fd6 Mon Sep 17 00:00:00 2001
From: Mustaq Ahmed Instead, chorded button presses can be detected by inspecting changes to the The modifications to the To identify button state transitions in any pointer event (and not just {{GlobalEventHandlers/pointerdown}} and {{GlobalEventHandlers/pointerup}}), the The In a multi-pointer (e.g. multi-touch) scenario, the To fire a pointer event named |e| means to [=fire an event=] named |e| using PointerEvent whose attributes are set as defined in {{PointerEvent}} Interface and Attributes and Default Actions. If the event is not a {{GlobalEventHandlers/gotpointercapture}}, {{GlobalEventHandlers/lostpointercapture}}, The target object at which the event is fired is determined as follows: Determine the target at which the event is fired as follows: Let |targetDocument| be target's [=Node/node document=] [[DOM]]. If the event is {{GlobalEventHandlers/pointerdown}}, {{GlobalEventHandlers/pointermove}}, or {{GlobalEventHandlers/pointerup}} set active document for the event's If the event is {{GlobalEventHandlers/pointerdown}}, {{GlobalEventHandlers/pointermove}}, or {{GlobalEventHandlers/pointerup}}, set active document for the event's If the event is {{GlobalEventHandlers/pointerdown}}, the associated device is a direct manipulation device, and the target is an {{Element}},
then set pointer capture for this A pointing device that moved relative to the screen surface or underwent some change in any of its properties fires various events as defined in Pointer Event types. For a stationary pointing device (that neither moved relative to the screen surface nor underwent any change in any properties), the user agent MUST fire certain boundary events after a layout change that affected the hit test target for the pointer, see {{GlobalEventHandlers/pointerover}}, {{GlobalEventHandlers/pointerenter}}, {{GlobalEventHandlers/pointerout}} and {{GlobalEventHandlers/pointerleave}} for details. The user agent MAY delay the firing of these boundary events because of performance reasons (e.g. to avoid too many hit-tests or layout changes caused by boundary event listeners). Pointer Events include two complementary sets of attributes to express the orientation of a transducer relative to the X-Y plane: Below are the event types defined in this specification. In the case of the primary pointer, these events (with the exception of {{GlobalEventHandlers/gotpointercapture}} and {{GlobalEventHandlers/lostpointercapture}}) may also fire compatibility mouse events. The user agent MUST fire a pointer event named {{GlobalEventHandlers/pointerover}} when a pointing device is moved into the hit test boundaries of an element. Note that The user agent MUST fire a pointer event named {{GlobalEventHandlers/pointerover}} when any of the following occurs: The user agent MUST fire a pointer event named {{GlobalEventHandlers/pointerenter}} when a pointing device is moved into the hit test boundaries of an element or one of its descendants, including as a result of a {{GlobalEventHandlers/pointerdown}} event from a device that does not support hover (see {{GlobalEventHandlers/pointerdown}}). Note that The user agent MUST fire a pointer event named {{GlobalEventHandlers/pointerenter}} when any of the following occurs: The user agent MUST fire a pointer event named {{GlobalEventHandlers/pointerdown}} when a pointer enters the active buttons state. For mouse, this is when the device transitions from no buttons depressed to at least one button depressed. For touch, this is when physical contact is made with the digitizer. For pen, this is when the pen either makes physical contact with the digitizer without any button depressed, or transitions from no buttons depressed to at least one button depressed while hovering. For input devices that do not support hover, the user agent MUST also fire a pointer event named {{GlobalEventHandlers/pointerover}} followed by a pointer event named {{GlobalEventHandlers/pointerenter}} prior to dispatching the {{GlobalEventHandlers/pointerdown}} event. The user agent MUST fire a pointer event named {{GlobalEventHandlers/pointermove}} when a pointer changes any properties that don't fire
@@ -745,6 +769,7 @@ Chorded button interactions
button
and buttons
properties. The button
and buttons
properties are inherited from the {{MouseEvent}} interface, but with a change in semantics and values, as outlined in the following sections.button
and buttons
properties apply only to pointer events. However for click
, auxclick
and contextmenu
the value of button
and buttons
MUST follow [[UIEVENTS]], as is the case for compatibility mouse events .The
button
propertybutton
property indicates the device button whose state change fired the event.The
button
propertybutton
property in a {{GlobalEventHandlers/pointermove}} event will be different from that in a mousemove
event. For example, while moving the mouse with the right button pressed, the {{GlobalEventHandlers/pointermove}} events will have the button
value -1, but the mousemove
events will have the button
value 2.The
buttons
propertybuttons
property gives the current state of the device buttons as a bitmask (same as in MouseEvent
, but with an expanded set of possible values).The
buttons
propertyThe primary pointer
isPrimary
property is used to identify a master pointer amongst the set of active pointers for each pointer type.Firing events using the
PointerEvent
interfaceclick
, auxclick
or contextmenu
event, run the process pending pointer capture steps for this PointerEvent
.
Firing events using the
PointerEvent
interfacepointerId
to |targetDocument|.pointerId
to |targetDocument|.pointerId
to the target element as described in implicit pointer capture.Suppressing a pointer event stream
Boundary events caused by layout changes
+ Converting between
tiltX
/ tiltY
and altitudeAngle
/ azimuthAngle
tiltX
/ tiltY
(introduced in the original Pointer Events specification), and azimuthAngle
/ altitudeAngle
(adopted from the Touch Events - Level 2 specification).Converting between
tiltX
/ tiltY
and altitud
Pointer Event types
The pointerover event
- setPointerCapture()
or releasePointerCapture()
might have changed the hit test target. Also note that while a pointer is captured it is considered to be always inside the boundaries of the capturing element for the purpose of firing boundary events. The user agent MUST also fire this event prior to firing a {{GlobalEventHandlers/pointerdown}} event for devices that do not support hover (see {{GlobalEventHandlers/pointerdown}}).
+
The pointerenter event
- setPointerCapture()
or releasePointerCapture()
might have changed the hit test target. Also note that while a pointer is captured it is considered to be always inside the boundaries of the capturing element for the purpose of firing boundary events. This event type is similar to {{GlobalEventHandlers/pointerover}}, but differs in that it does not bubble.
+
+ mouseenter
event described in [[UIEVENTS]], and the CSS :hover
pseudo-class described in [[CSS21]]. See also the {{GlobalEventHandlers/pointerleave}} event.The pointerdown event
The pointerdow
isPrimary
property is true
). This sets the PREVENT MOUSE EVENT
flag on the pointer. Note, however, that this does not prevent the mouseover
, mouseenter
, mouseout
, or mouseleave
events from firing.The pointermove event
The pointermov
The coalesced events information will be exposed via the
getCoalescedEvents()
method for the single dispatched {{GlobalEventHandlers/pointermove}} event.
The final coordinates of such events should be used for finding the target of the event.
The user agent MUST fire a pointer event @@ -775,6 +800,7 @@
The user agent MUST fire a pointer event named {{GlobalEventHandlers/pointerup}} when a pointer leaves the active buttons state. For mouse, this is when the device transitions from at least one button depressed to no buttons depressed. For touch, this is when physical contact is removed from the digitizer. For pen, this is when the pen is removed from the physical contact with the digitizer while no button is depressed, or transitions from at least one button depressed to no buttons depressed while hovering.
@@ -783,39 +809,47 @@The user agent MUST also implicitly release the pointer capture if the pointer is currently captured.
mousedown
and mouseup
. See chorded buttons for more information.The user agent MUST fire a pointer event named {{GlobalEventHandlers/pointercancel}} when it detects a scenario to suppress a pointer event stream.
The values of the following properties of the {{GlobalEventHandlers/pointercancel}} event MUST match the values of the last dispatched pointer event with the same pointerId
: width
, height
, pressure
, tangentialPressure
, tiltX
, tiltY
, twist
, altitudeAngle
, azimuthAngle
, pointerType
, isPrimary
, and the coordinates inherited from [[UIEVENTS]]. The coalescedEvents
and predictedEvents
lists in the {{GlobalEventHandlers/pointercancel}} event MUST be empty, and the event's {{Event/cancelable}} attribute MUST be false.
The user agent MUST fire a pointer event named {{GlobalEventHandlers/pointerout}} when any of the following occurs:
setPointerCapture()
or releasePointerCapture()
might have changed the hit test target and while a pointer is captured it is considered to be always inside the boundaries of the capturing element for the purpose of firing boundary events.The user agent MUST fire a pointer event named {{GlobalEventHandlers/pointerleave}} when any of the following occurs:
setPointerCapture()
or releasePointerCapture()
might have changed the hit test target and while a pointer is captured it is considered to be always inside the boundaries of the capturing element for the purpose of firing boundary events.This event type is similar to {{GlobalEventHandlers/pointerout}}, but differs in that it does not bubble and that it MUST not be fired until the pointing device has left the boundaries of the element and the boundaries of all of its descendants.
-mouseleave
event described in [[UIEVENTS]], and the CSS :hover
pseudo-class described in [[CSS21]]. See also the pointerenter
event.mouseleave
event described in [[UIEVENTS]], and the CSS :hover
pseudo-class described in [[CSS21]]. See also the {{GlobalEventHandlers/pointerenter}} event.The user agent MUST fire a pointer event named {{GlobalEventHandlers/gotpointercapture}} when an element receives pointer capture. This event is fired at the element that is receiving pointer capture. Subsequent events for that pointer will be fired at this element. See the setting pointer capture and process pending pointer capture sections.
The user agent MUST fire a pointer event named {{GlobalEventHandlers/lostpointercapture}} after pointer capture is released for a pointer. This event MUST be fired prior to any subsequent events for the pointer after capture was released. This event is fired at the element from which pointer capture was removed. All subsequent events for the pointer except click
, auxclick
, and contextmenu
events follow normal hit testing mechanisms (out of scope for this specification) for determining the event target. See the releasing pointer capture, implicit release of pointer capture, and process pending pointer capture sections.
click
, auxclick
, and contextmenu
eventsThis section is an addition to click, @@ -830,6 +864,7 @@
pointerId
MUST be -1
and pointerType
MUST be an empty string.As noted in {{PointerEvent}}, [[[CSSOM-VIEW]]] proposes to redefine the various coordinate properties (screenX
, screenY
, pageX
, pageY
, clientX
,
@@ -839,6 +874,7 @@
click
, auxclick
, and contextmenu
to long
values (as defined in the original [[[UIEVENTS]]]) using Math.floor [[ECMASCRIPT]].
A click
, auxclick
or contextmenu
event MUST follow the dispatch process defined in the [[UIEVENTS]] spec except that the event target is overridden using the algorithm below:
maxTouchPoints
is often used to ensure that the interaction model of the content can be recognized by the current hardware. UI affordances can be provided to users with less capable hardware. On platforms where the precise number of touch points is not known, the minimum number guaranteed to be recognized is provided. Therefore, it is possible for the number of recognized touch points to exceed the value of maxTouchPoints
.As noted in Attributes and Default Actions, viewport manipulations (panning and zooming) cannot be suppressed by canceling a pointer event. Instead, authors must declaratively define which of these behaviors they want to allow, and which they want to suppress, using the touch-action
CSS property.
Pointer capture is set on an |element| of type {{Element}} by calling the element.setPointerCapture(pointerId)
method.
@@ -1138,12 +1177,14 @@
pointerId
, clear the pending pointer capture target override, if set.Inputs that implement direct manipulation interactions for panning and zooming (such as touch or stylus on a touchscreen) SHOULD behave exactly as if setPointerCapture() was called on the target element just before the invocation of any {{GlobalEventHandlers/pointerdown}} listeners. The hasPointerCapture API may be used (eg. within any {{GlobalEventHandlers/pointerdown}} listener) to determine whether this has occurred. If releasePointerCapture() is not called for the pointer before the next pointer event is fired, then a {{GlobalEventHandlers/gotpointercapture}} event will be dispatched to the target (as normal) indicating that capture is active.
Immediately after firing the {{GlobalEventHandlers/pointerup}} or {{GlobalEventHandlers/pointercancel}} events, @@ -1165,6 +1206,7 @@
The vast majority of web content existing today codes only to Mouse Events. The following describes an algorithm for how the user agent MAY map generic pointer input to mouse events for compatibility with this content.
@@ -1448,6 +1491,7 @@Whenever the user agent is to dispatch a pointer event for a device that supports hover, it SHOULD run the following steps:
@@ -1467,6 +1511,7 @@PREVENT MOUSE EVENT
flag for this pointerType
.Some devices, such as most touchscreens, do not support hovering a coordinate (or set of coordinates) while not in the active state. Much existing content coded to mouse events assumes that a mouse is producing the events and thus certain qualities are generally true:
@@ -1531,6 +1576,7 @@This appendix discusses security and privacy considerations for Pointer Events implementations. The discussion is limited to security and privacy issues that arise directly from implementation of the event model, APIs and events defined in this specification.
@@ -1557,6 +1603,7 @@Many thanks to lots of people for their proposals and recommendations, some of which are incorporated into this document. The group's Chair acknowledges contributions from the following past and present group members and participants: @@ -1648,6 +1696,7 @@
Special thanks to those that helped pioneer the first edition of this model, including especially: Charu Chandiram, Peter Freiling, Nathan Furtwangler, Thomas Olsen, Matt Rakow, Ramu Ramanathan, Justin Rogers, Jacob Rossi, Reed Townsend and Steve Wright.
The following is an informative summary of substantial and major editorial changes between publications of this specification, relative to the [[PointerEvents3]] specification.