Please check the errata for any errors or issues reported since publication.
See also translations.
Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.
This document defines events and related interfaces for handling hardware agnostic pointer input from devices including a mouse, pen, touchscreen, etc.. For compatibility with existing mouse based content, this specification also describes a mapping to fire [DOM-LEVEL-3-EVENTS] Mouse Events for other pointer device types.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This specification is a Superseded Recommendation. A newer specification exists that is recommended for new adoption in place of this specification.
The Pointer Events Working Group has demonstrated implementability and interoperability with the Pointer Events test suite and implementation report. Feedback on the specification, test suite, or implementation report may be sent to public-pointer-events@w3.org (archives).
For purposes of the W3C Patent Policy, this Superseded Recommendation has the same status as an active Recommendation; it retains licensing commitments and remains available as a reference for old -- and possibly still deployed -- implementations, but is not recommended for future implementation. New implementations should follow the latest version of the HTML specification.
This document is governed by the 14 October 2005 W3C Process Document.
PointerEvent InterfacePointerEvent interfacepointerover eventpointerenter eventpointerdown eventpointermove eventpointerup eventpointercancel eventpointerout eventpointerleave eventgotpointercapture eventlostpointercapture eventElement interfaceGlobalEventHandlers interfaceNavigator interfaceThis section is non-normative.
Today, most [HTML5] content is used with and/or designed for mouse input. Those that handle input in a custom manner typically code to [DOM-LEVEL-3-EVENTS] Mouse Events. Newer computing devices today, however, incorporate other forms of input, including touchscreens, pen input, etc. Event types have been proposed for handling each of these forms of input individually. However, that approach often incurs unnecessary duplication of logic and event handling overhead when adding support for a new input type. This often creates a compatibility problem when content is written with only one device type in mind. Additionally, for compatibility with existing mouse-based content, most user agents fire Mouse Events for all input types. This makes it ambiguous whether a Mouse Event represents an actual mouse device or is being produced from another input type for compatibility, which makes it hard to code to both device types simultaneously.
To reduce the cost of coding to multiple input types and also to help with the above described ambiguity with Mouse Events, this specifications defines a more abstract form of input, called a pointer. A pointer can be any point of contact on the screen made by a mouse cursor, pen, touch (including multi-touch), or other pointing input device. This model makes it easier to write sites and applications that work well no matter what hardware the user has. For scenarios when device-specific handling is desired, this specification also defines properties for inspecting the device type which produced the event. The primary goal is to provide a single set of events and interfaces that allow for easier authoring for cross-device pointer input while still allowing for device-specific handling only when necessary for an augmented experience.
An additional key goal is to enable multi-threaded user agents to handle default touch actions, such as scrolling, without blocking on script execution.
While this specification defines a unified event model for a variety pointer inputs, this model does not cover other forms of input such as keyboards or keyboard-like interfaces (for instance, a screenreader or similar assistive technology running on a touchscreen-only device, which allows users sequential navigation through focusable controls and elements). While user agents might choose to also generate pointer events in response to these interfaces, this scenario is not covered in this specification.
In the first instance, authors are encouraged to provide equivalent functionality for all forms of input by responding to high-level events such as focus, blur and click. However, when using low-level events (such as Pointer Events), authors are encouraged to ensure that all types of input are supported. In the case of keyboards and keyboard-like interfaces, this might require the addition of explicit keyboard event handling. See WCAG 2.0 Guideline 2.1 for further details.
The events for handling generic pointer input look a lot like those for mouse: pointerdown, pointermove, pointerup, pointerover, pointerout, etc. This facilitates easy content migration from Mouse Events to Pointer Events. Pointer Events provide all the usual properties present in Mouse Events (client coordinates, target element, button states, etc.) in addition to new properties for other forms of input: pressure, contact geometry, tilt, etc. So authors can easily code to Pointer Events to share logic between different input types where it makes sense, and customize for a particular type of input only where necessary to get the best experience.
While Pointer Events are sourced from a variety of input devices, they are not defined as being generated from some other set of device-specific events. While possible and encouraged for compatibility, this spec does not require other device-specific events be supported (e.g. mouse events, touch events, etc.). A user agent could support pointer events without supporting any other device events. For compatibility with content written to mouse-specific events, this specification does provide an optional section describing how to generate compatibility mouse events based on pointer input from devices other than a mouse.
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MAY, MUST, MUST NOT, OPTIONAL, and SHOULD are to be interpreted as described in [RFC2119].
This section is non-normative.
The following are example author code that demonstrates how the APIs in this specification might be used.
<style>
/* Disable intrinsic user agent touch behaviors (such as panning or zooming) so
that all events on the canvas element are given to the application instead. */
canvas {
touch-action: none;
}
</style>
<canvas id="drawSurface" width="500px" height="500px" style="border:1px solid black;"></canvas>
<script type='text/javascript'>
var canvas = document.getElementById("drawSurface"),
context = canvas.getContext("2d");
if (window.PointerEvent) {
canvas.addEventListener("pointermove", paint, false);
if(window.navigator.maxTouchPoints>1)
/* User agent and hardware support multi-touch */
}
else {
//Provide fallback for user agents that do not support Pointer Events
canvas.addEventListener("mousemove", paint, false);
}
function paint(event) {
if(event.buttons>0)
context.fillRect(event.clientX, event.clientY, 5, 5);
}
</script>window.addEventListener("pointerdown", detectInputType, false);
function detectInputType(event) {
switch(event.pointerType) {
case "mouse":
/* mouse input detected */
break;
case "pen":
/* pen/stylus input detected */
break;
case "touch":
/* touch input detected */
break;
default:
/* pointerType is empty (could not be detected)
or UA-specific custom type */
}
}<div style="position:absolute; top:0px; left:0px; width:100px;height:100px;"></div>
<script>
window.addEventListener("pointerdown", checkPointerSize, false);
function checkPointerSize(event) {
event.target.style.width = event.width + "px";
event.target.style.height = event.height + "px";
}
</script>var event = new PointerEvent("pointerover",
{bubbles: true,
cancelable: true,
pointerId: 42,
pointerType: "pen",
clientX: 300,
clientY: 500
});
eventTarget.dispatchEvent(event); This section is non-normative.
buttons property. For mouse, this is when the device has at least one button depressed. For touch, this is when there is physical contact with the digitizer. For pen, this is when the pen has physical contact with the digitizer.pointerId) to produce additional events within the document, then that pointer is still considered active. Examples:
preventDefault(), returning false in an event handler, or other means as defined by [DOM-LEVEL-3-EVENTS] and [HTML5].PointerEvent Interfacedictionary PointerEventInit : MouseEventInit {
long pointerId = 0;
double width = 0;
double height = 0;
float pressure = 0;
long tiltX = 0;
long tiltY = 0;
DOMString pointerType = "";
boolean isPrimary = false;
};
[Constructor(DOMString type, optional PointerEventInit eventInitDict)]
interface PointerEvent : MouseEvent {
readonly attribute long pointerId;
readonly attribute double width;
readonly attribute double height;
readonly attribute float pressure;
readonly attribute long tiltX;
readonly attribute long tiltY;
readonly attribute DOMString pointerType;
readonly attribute boolean isPrimary;
};pointerId of type long, readonly A unique identifier for the pointer causing the event. This identifier MUST be unique from all other active pointers at the time. A user agent MAY recycle previously retired values for pointerId from previous active pointers, if necessary.
pointerId selection algorithm is implementation specific. Therefore authors cannot assume values convey any particular meaning other than an identifier for the pointer that is unique from all other active pointers. As an example, values are not guaranteed to be monotonically increasing.width of type double, readonly height of type double, readonly pressure of type float, readonly tiltX of type long, readonly The plane angle (in degrees, in the range of [-90,90]) between the Y-Z plane and the plane containing both the transducer (e.g. pen stylus) axis and the Y axis. A positive tiltX is to the right. tiltX can be used along with tiltY to represent the tilt away from the normal of a transducer with the digitizer. For devices that do not report tilt, the value MUST be 0.
tiltX.tiltY of type long, readonly tiltY is towards the user. tiltY can be used along with tiltX to represent the tilt away from the normal of a transducer with the digitizer. For devices that do not report tilt, the value MUST be 0.
tiltY.pointerType of type DOMString, readonly Indicates the device type that caused the event (mouse, pen, touch, etc.). If a user agent is to fire a pointer event for a mouse, pen stylus, or touch input device, then the value of pointerType MUST be according to the following table:
| Pointer Device Type | pointerType Value |
|---|---|
| Mouse | mouse |
| Pen Stylus | pen |
| Touch Contact | touch |
If the device type cannot be detected by the user agent, then the value MUST be an empty string. If a user agent supports pointer device types other than those listed above, the value of pointerType SHOULD be vendor prefixed to avoid conflicting names for different types of devices. Future specifications MAY provide additional normative values for other device types.
pointerType can be used. Also note that developers should include some form of default handling to cover user agents that may have implemented their own custom pointerType values and for situations where pointerType is simply an empty string.
isPrimary of type boolean, readonly PointerEventInit MemberspointerId of type long, defaulting to 0pointerId property of the PointerEvent object.width of type double, defaulting to 0width property of the PointerEvent object.height of type double, defaulting to 0height property of the PointerEvent object.pressure of type float, defaulting to 0pressure property of the PointerEvent object.tiltX of type long, defaulting to 0tiltX property of the PointerEvent object.tiltY of type long, defaulting to 0tiltY property of the PointerEvent object.pointerType of type DOMString, defaulting to ""pointerType property of the PointerEvent object.isPrimary of type boolean, defaulting to falseisPrimary property of the PointerEvent object.PointerEventInit dictionary is used by the PointerEvent interface's constructor to provide a mechanism by which to construct untrusted (synthetic) pointer events. It inherits from the MouseEventInit dictionary defined in [DOM-LEVEL-3-EVENTS]. The steps for constructing an event are defined in [DOM4]. See the examples for sample code demonstrating how to fire an untrusted pointer event.PointerEvent interface inherits from MouseEvent, defined in [DOM-LEVEL-3-EVENTS] and extended by [CSSOM-VIEW].In a multi-pointer (e.g. multi-touch) scenario, the isPrimary property is used to identify a master pointer amongst the set of active pointers for each pointer type. Only a primary pointer will produce compatibility mouse events. Authors who desire single-pointer interaction can achieve this by ignoring non-primary pointers (however, see the note below on multiple primary pointers).
pointerdown event was dispatched when no other active pointers representing touch input existed.pointerdown event was dispatched when no other active pointers representing pen input existed.pointerType) are considered primary. For example, a touch contact and a mouse cursor moved simultaneously will produce pointers that are both considered primary.false for isPrimary.PointerEvent interfacePointerEvent interface whose attributes are set as defined in PointerEvent Interface.
Initialize the bubbles attribute for the event to true if the event name is
pointerdownpointeruppointercancelpointermovepointeroverpointeroutgotpointercapturelostpointercaptureInitialize the cancelable attribute for the event to true if the event name is
pointerdownpointeruppointermovepointeroverpointeroutThe target object at which the event is fired is determined as follows:
relatedTarget attribute of the event to null.Whenever a user agent is to fire a Pointer Event that is not gotpointercapture or lostpointercapture, it must first run these steps:
lostpointercapture at the pointer capture target override node.gotpointercapture at the pending pointer capture target override.
pointerover and pointerenter events, then fire a pointer event named pointerout and a pointer event named pointerleave at the hit test node.This section is non-normative.
The following table provides a summary of the event types defined in this specification.
| Event Type | Sync/Async | Bubbles | Cancelable | Default Action |
|---|---|---|---|---|
pointerover |
Sync | Yes | Yes | Varies: when the pointer is primary, all default actions of mouseover |
pointerenter |
Sync | No | No | Varies: when the pointer is primary, all default actions of mouseenter |
pointerdown |
Sync | Yes | Yes | Varies: when the pointer is primary, all default actions of the mousedown event
Canceling this event also sets the PREVENT MOUSE EVENT flag for this pointerType, which prevents subsequent firing of certain compatibility mouse events. |
pointermove |
Sync | Yes | Yes | Varies: when the pointer is primary, all default actions of mousemove |
pointerup |
Sync | Yes | Yes | Varies: when the pointer is primary, all default actions of mouseup |
pointercancel |
Sync | Yes | No | None |
pointerout |
Sync | Yes | Yes | Varies: when the pointer is primary, all default actions of mouseout |
pointerleave |
Sync | No | No | Varies: when the pointer is primary, all default actions of mouseleave |
gotpointercapture |
Sync/Async | Yes | No | None |
lostpointercapture |
Sync/Async | Yes | No | None |
In the case of the primary pointer, these events (with the exception of gotpointercapture, and lostpointercapture) may also fire compatibility mouse events.
pointerover eventpointerover when a pointing device is moved into the hit test boundaries of an element. A user agent MUST also fire this event prior to firing a pointerdown event for devices that do not support hover (see pointerdown).pointerenter eventpointerenter 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 pointerdown event from a device that does not support hover (see pointerdown). This event type is similar to pointerover, but differs in that it does not bubble.mouseenter event described in [DOM-LEVEL-3-EVENTS], and the CSS :hover pseudo-class described in [CSS21]. See also the pointerleave event.pointerdown eventA user agent MUST fire a pointer event named 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 stylus makes physical contact with the digitizer.
pointerdown and pointerup are not fired for all of the same circumstances as mousedown and mouseup. See chorded buttons for more information.For input devices that do not support hover, a user agent MUST also fire a pointer event named pointerover followed by a pointer event named pointerenter prior to dispatching the pointerdown event.
pointerdown event (if the 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.pointermove eventpointermove when a pointer changes coordinates. Additionally, when a pointer changes button state, pressure, tilt, or contact geometry (e.g. width and height) and the circumstances produce no other pointer events defined in this specification then a user agent MUST fire a pointer event named pointermove.pointerup eventpointerup 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 physical contact with the digitizer.
For input devices that do not support hover, a user agent MUST also fire a pointer event named pointerout followed by a pointer event named pointerleave after dispatching the pointerup event.
pointerdown and pointerup are not fired for all of the same circumstances as mousedown and mouseup. See chorded buttons for more information.pointercancel eventpointercancel in the following circumstances:
pointerdown event, if the pointer is subsequently used to manipulate the page viewport (e.g. panning or zooming).After firing the pointercancel event, a user agent MUST also fire a pointer event named pointerout followed by firing a pointer event named pointerleave.
This section is non-normative.
Examples of scenarios in which a user agent might determine that a pointer is unlikely to continue to produce events include:
Methods for changing the device's screen orientation, recognizing accidental input, or using a pointer to manipulate the viewport (e.g. panning or zooming) are out of scope for this specification.
pointerout eventpointerout when any of the following occurs:
pointerup event for a device that does not support hover (see pointerup).pointercancel event (see pointercancel).pointerleave eventpointerleave when a pointing device is moved out of the hit test boundaries of an element and all of its descendants, including as a result of a pointerup and pointercancel events from a device that does not support hover (see pointerup and pointercancel). User agents MUST also fire a pointer event named pointerleave when a pen stylus leaves hover range detectable by the digitizer. This event type is similar to 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 [DOM-LEVEL-3-EVENTS], and the CSS :hover pseudo-class described in [CSS21]. See also the pointerenter event.gotpointercapture eventgotpointercapture 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.lostpointercapture eventlostpointercapture 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. Subsequent events for the pointer 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.Element interfaceThe following section describes extensions to the existing Element interface, defined in [HTML5], to facilitate the setting and releasing of pointer capture.
partial interface Element {
attribute EventHandler ongotpointercapture;
attribute EventHandler onlostpointercapture;
void setPointerCapture (long pointerId);
void releasePointerCapture (long pointerId);
};setPointerCaptureSets pointer capture for the pointer identified by the argument pointerId to the element on which this method is invoked. Subsequent events for the pointer MUST always be targeted at this element until capture is released. The pointer MUST be in its active buttons state for this method to be effective, otherwise it fails silently. Throws a DOMException with the name InvalidPointerId when the provided method's argument does not match any of the active pointers.
| Parameter | Type | Nullable | Optional | Description |
|---|---|---|---|---|
| pointerId | long | ✘ | ✘ |
voidreleasePointerCaptureReleases pointer capture for the pointer identified by the argument pointerId from the element on which this method is invoked. Subsequent events for the pointer follow normal hit testing mechanisms (out of scope for this specification) for determining the event target. Throws a DOMException with the name InvalidPointerId when the provided the method's argument does not match any of the active pointers.
| Parameter | Type | Nullable | Optional | Description |
|---|---|---|---|---|
| pointerId | long | ✘ | ✘ |
voidGlobalEventHandlers interfaceThe following section describes extensions to the existing GlobalEventHandlers interface, defined in [HTML5], to facilitate the event handler registration.
partial interface GlobalEventHandlers {
attribute EventHandler onpointerdown;
attribute EventHandler onpointermove;
attribute EventHandler onpointerup;
attribute EventHandler onpointercancel;
attribute EventHandler onpointerover;
attribute EventHandler onpointerout;
attribute EventHandler onpointerenter;
attribute EventHandler onpointerleave;
};onpointerdown of type EventHandler, pointerdown event type.
onpointermove of type EventHandler, pointermove event type.
onpointerup of type EventHandler, pointerup event type.
onpointercancel of type EventHandler, pointercancel event type.
onpointerover of type EventHandler, pointerover event type.
onpointerout of type EventHandler, pointerout event type.
onpointerenter of type EventHandler, pointerenter event type.
onpointerleave of type EventHandler, pointerleave event type.
For touch input, the default action of any and all pointer events MUST NOT be a manipulation of the viewport (e.g. panning or zooming).
touch-action CSS property| Name: | touch-action |
|---|---|
| Value: | auto | none | [ pan-x || pan-y ] | manipulation |
| Initial: | auto |
| Applies to: | all elements except: non-replaced inline elements, table rows, row groups, table columns, and column groups. |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | Same as specified value. |
The touch-action CSS property determines whether touch input MAY trigger default behavior supplied by user agent. This includes, but is not limited to, behaviors such as panning or zooming.
Values have the following meanings:
auto are out of scope for this specification.auto or none values are out of scope for this specification.touch-action property only applies to elements that support both the CSS width and height properties (see [CSS21]). This restriction is designed to facilitate user agent optimizations for low-latency touch actions. For elements not supported by default, such as <span> which is a non-replaced inline element (see [HTML5]), authors can set the display CSS property to a value, such as block, that supports width and height. Future specifications could extend this API to all elements.When a user touches an element, the effect of that touch is determined by the value of the touch-action property and the default touch behaviors on the element and its ancestors. To determine the effect of a touch, find the nearest ancestor (starting from the element itself) that has a default touch behavior. Then examine the touch-action property of each element between the hit tested element and the element with the default touch behavior (including both the hit tested element and the element with the default touch behavior). If the touch-action property of any of those elements disallows the default touch behavior, do nothing. Otherwise allow the element to start considering the touch for the purposes of executing a default touch behavior.
touch-action values of multiple concurrent pointers is out of scope for this specification.During the execution of a user agent touch behavior, the user agent MUST NOT fire subsequent pointer events for the pointer. The user agent MUST fire a pointer event named pointercancel (and subsequently a pointerout event and one or more pointerleave events) whenever all of the following are true, in order to end the stream of events for the pointer:
pointerdown event has been sent for the pointer, andpointerup or pointercancel event (following the above mentioned pointerdown) has not yet been sent for the pointer.<div style="touch-action: none;">
This element receives pointer events for all touches.
</div><div style="touch-action: pan-x;">
This element receives pointer events when not panning in the horizontal direction.
</div><div style="overflow: auto;">
<div style="touch-action: none;">
This element receives pointer events for all touches.
</div>
<div>
Touches on this element MAY be consumed for manipulating the parent.
</div>
</div> <div style="overflow: auto;">
<div style="touch-action: pan-y;">
<div style="touch-action: pan-x;">
This element receives pointer events for all touches because
it allows only horizontal panning yet an intermediate ancestor
(between it and the pannable element) only allows vertical panning.
Therefore, no touch behaviors are allowed.
</div>
</div>
</div>
Pointer capture allows the events for a particular pointer (including any compatibility mouse events) to be retargeted to a particular element other than the normal hit test result of the pointer's location. This is useful in scenarios like a custom slider control (e.g. similar to the [HTML5] <input type="range"> control). Pointer capture can be set on the slider thumb element, allowing the user to slide the control back and forth even if the pointer slides off of the thumb.
pointerdown on the thumb, pointer capture can be used to allow the user to slide the thumb even if the pointer drifts off of it.element.setPointerCapture(pointerId) method. When this method is invoked, a user agent MUST run the following steps:
pointerId provided as the method's argument does not match any of the active pointers, then throw a DOMException with the name InvalidPointerId.Element on which this method is invoked does not participate in its ownerDocument's tree, throw an exception with the name InvalidStateError.pointerId, set the pending pointer capture target override to the Element on which this method was invoked.pointerover, pointerout, pointerenter, and pointerleave events are only generated when crossing the boundary of the element that has capture as other elements can no longer be targeted by the pointer. This has the effect of suppressing these events on all other elements.element.releasePointerCapture(pointerId) method. When this method is called, a user agent MUST run the following steps:
pointerId provided as the method's argument does not match any of the active pointers and these steps are not being invoked as a result of the implicit release of pointer capture, then throw a DOMException with the name InvalidPointerId.pointerId is not the Element on which this method was invoked, then terminate these steps.pointerId, clear the pending pointer capture target override, if set.gotpointercapture and lostpointercapture events, even though no explicit pointer capture functions (setPointerCapture and releasePointerCapture) were called.Immediately after firing the pointerup or pointercancel events, a user agent MUST run the steps as if the releasePointerCapture() method has been called with an argument equal to the pointerId property of the pointerup or pointercancel event just dispatched.
When the pointer capture target override is removed from its ownerDocument's tree, clear the pending pointer capture target override and pointer capture target override nodes and fire a PointerEvent named lostpointercapture at the document.
The vast majority of web content existing today codes only to Mouse Events. The following describes an algorithm for how a user agent MAY map generic pointer input to mouse events for compatibility with this content.
Unless otherwise noted, the target of any mapped mouse event SHOULD be the same target as the respective pointer event unless the target is no longer participating in its ownerDocument's tree. In this case, the mouse event should be fired at the original target's nearest ancestor node (at the time it was removed from the tree) that still participates in its ownerDocument's tree, meaning that a new event path (based on the new target node) is built for the mouse event.
Authors can prevent the production of certain compatibility mouse events by canceling the pointerdown event.
mouseover, mouseout, mouseenter, and mouseleave events are never prevented (even if the pointer is down).The compatibility mapping with mouse events are an OPTIONAL feature of this specification. User agents are encouraged to support the feature for best compatibility with existing legacy content. User agents that do not support compatibility mouse events are still encouraged to support the click and contextmenu events (see the note below).
The click event, defined in [DOM-LEVEL-3-EVENTS], and the contextmenu event, defined in [HTML5], are not considered compatibility mouse events as they are typically tied to user interface activation and are fired from other input devices, like keyboards.
In user agents that support firing click and/or contextmenu, calling preventDefault during a pointer event typically does not have an effect on whether click and/or contextmenu are fired or not. Because they are not compatibility mouse events, user agents typically fire click and contextmenu for all pointing devices, including pointers that are not primary pointers.
The relative ordering of these high-level events (click, contextmenu, focus, blur, etc.) with pointer events is undefined and varies between user agents. For example, in some user agents contextmenu will often follow a pointerup, in others it'll often precede a pointerup or pointercancel, and in some situations it may be fired without any corresponding pointer event (such as a keyboard shortcut).
isPrimary property for the pointer event to be dispatched is false then dispatch the pointer event and terminate these steps.pointerdown and the event was canceled, then set the PREVENT MOUSE EVENT flag for this pointerType.pointerover, then fire a mouseover event.pointerout, then fire a mouseout event.pointerenter, then fire a mouseenter event.pointerleave, then fire a mouseleave event.pointerType and the pointer event dispatched was:
pointerdown, then fire a mousedown event.pointermove, then fire a mousemove event.pointerup, then fire a mouseup event.pointercancel, then fire a mouseup event at the window.pointerup or pointercancel, clear the PREVENT MOUSE EVENT flag for this pointerType.mousemove event on an element before clicking it.isPrimary property for the pointer event to be dispatched is false then dispatch the pointer event and terminate these steps.pointerover and the pointerdown event has not yet been dispatched for this pointer, then fire a mousemove event (for compatibility with legacy mouse-specific code).pointerdown and the event was canceled, then set the PREVENT MOUSE EVENT flag for this pointerType.pointerover, then fire a mouseover event.pointerout, then fire a mouseout event.pointerenter, then fire a mouseenter event.pointerleave, then fire a mouseleave event.pointerType and the pointer event dispatched was:
pointerdown, then fire a mousedown event.pointermove, then fire a mousemove event.pointerup, then fire a mouseup event.pointercancel, then fire a mouseup event at the window.pointerup or pointercancel, clear the PREVENT MOUSE EVENT flag for this pointerType.The activation of an element (click) with a primary pointer that does not support hover (e.g. single finger on a touchscreen) would typically produce the following event sequence:
mousemovepointerovermouseoverpointerentermouseenterpointerdownmousedownpointermove and mousemove events, depending on movement of the pointerpointerupmouseupclickpointeroutmouseoutmouseleaveIf, however, the pointerdown event is canceled during this interaction then the sequence of events would be:
mousemovepointerovermouseoverpointerentermouseenterpointerdownpointermove events, depending on movement of the pointerpointerupclickpointeroutmouseoutmouseleaveMany 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 group members: Arthur Barstow, Matt Brubeck, Rick Byers, Cathy Chan, Scott González, Patrick H. Lauke, Sangwhan Moon, Olli Pettay, Jacob Rossi, Doug Schepers and Asir Vedamuthu.
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, Steve Wright.
This section is non-normative.
The following is an informative summary of substantial and major editorial changes between publications of this specification. A complete revision history of the Editor's Drafts of this specification can be found here.
This section is non-normative.