W3cubDocs

/DOM Events

pointercancel

The pointercancel event is fired when the browser determines that there are unlikely to be any more pointer events, or if after the pointerdown event is fired, the pointer is then used to manipulate the viewport by panning, zooming, or scrolling.

Some examples of situations that will trigger a pointercancel event:

  • A hardware event occurs that cancels the pointer activities. This may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device.
  • The device's screen orientation is changed while the pointer is active.
  • The browser decides that the user started pointer input accidentally. This can happen if, for example, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events.
  • The touch-action CSS property prevents the input from continuing.

After the pointercancel event is fired, the browser will also send pointerout followed by pointerleave.

General info

Specification
Pointer Events
Interface
PointerEvent
Bubbles
Yes
Cancelable
No
Target
Document, Element
Default Action
None

Properties

Property Type Description
target Read only EventTarget The event target (the topmost target in the DOM tree).
type Read only DOMString The type of event.
bubbles Read only Boolean Whether the event normally bubbles or not.
cancelable Read only Boolean Whether the event is cancellable or not.
view Read only WindowProxy document.defaultView (window of the document)
detail Read only long (float) 0.
pointerId Read only long A unique identifier for the pointer causing the event.
width Read only double (float) The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer.
height Read only double (float) The height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer.
pressure Read only float The normalized pressure of the pointer input in the range of 0 to 1, where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively.
tiltX Read only long (float) The plane angle (in degrees, in the range of -90 to 90) between the Y-Z plane and the plane containing both the transducer (e.g. pen stylus) axis and the Y axis.
tiltY Read only long (float) The plane angle (in degrees, in the range of -90 to 90) between the X-Z plane and the plane containing both the transducer (e.g. pen stylus) axis and the X axis.
pointerType Read only string Indicates the device type that caused the event. Must be one of the strings mouse, pen or touch, or an empty string.
isPrimary Read only boolean Indicates if the pointer represents the primary pointer of this pointer type.

Examples

// pointercancel event handler
target.addEventListener("pointercancel", function(ev) {
  // Process the event
}, false);

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 55.0 (Yes) 59 (59) 10 42 No support
Feature Android Android Webview Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support 55.0 (Yes) No support 10 42 No support 55.0

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/Events/pointercancel