In JavaScript, the pointercancel event fires when the browser decides there will likely be no more events for that pointer, or when after pointerdown the pointer is used to pan, zoom, or scroll the viewport (MDN).
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Syntax
Listen for pointercancel. Start with this line.
JavaScript
addEventListener("pointercancel", fn)
Call
What it does
addEventListener("pointercancel", fn)
Primary signature.
Built into the browser. Listen with el.addEventListener("pointercancel", …) — no import required.
Library declarations
JavaScript
addEventListener("pointercancel", fn)
Parameters
Parameter
Description
Event name
Required. "pointercancel"
Handler prop
Optional. onpointercancel
PointerEvent
Required. pointerId, pointerType, …
Cleanup
Required. Reset UI / release capture state
Return Value
Return Value
Description
*
Fires as an Element event (listener receives the Event object).
Clear on cancel. MDN: unlikely more events for that pointer.
Avoid sticky UI — never leave “dragging” true after a cancel.
Compatibility
Browser Support
Elementpointercancel is Baseline Widely available (MDN: since July 2020). Safe for modern evergreen browsers.
✓ Baseline · Widely available
pointercancel
Fires when the browser cancels a pointer stream. Essential cleanup for drag/draw gestures.
99%Widely available
Google ChromeYes
Yes
Microsoft EdgeYes
Yes
Mozilla FirefoxYes
Yes
Apple SafariYes
Yes
OperaYes
Yes
Internet ExplorerIE11 (Pointer Events)
Partial
pointercancelExcellent
Bottom line: Listen for pointercancel whenever you start a gesture on pointerdown. See the MDN pointercancel reference.
Frequently Asked Questions
MDN: it fires when the browser determines there are unlikely to be more pointer events, or when after pointerdown the pointer is used to pan, zoom, or scroll the viewport. Use it to abort in-progress gestures.
No. MDN marks Element pointercancel as Baseline Widely available (since July 2020). It is not Deprecated, Experimental, or Non-standard.
A PointerEvent. Useful fields include pointerId, pointerType, isPrimary, and pressure.
MDN: the browser also sends pointerout followed by pointerleave after pointercancel.
Whenever you start a drag, draw, or press-and-hold on pointerdown. Cancel resets UI if the OS steals the gesture (home button, app switcher, orientation change, palm rejection, touch-action scroll, too many pointers).
If you used setPointerCapture, a cancel path can also fire lostpointercapture. Clear drag state on pointercancel and/or lostpointercapture so the UI never sticks.