The touchcancel event fires when one or more touch points are disrupted. Learn TouchEvent, changedTouches, how it differs from touchend, cleanup patterns, Pointer Events alternatives, and five try-it labs.
01
Kind
Instance event
02
Type
TouchEvent
03
When
Touch disrupted
04
Handler
ontouchcancel
05
Bubbles?
Yes
06
Status
Limited availability
Fundamentals
Introduction
Touch gestures do not always end with a clean finger lift. touchcancel means the browser or device aborted the touch—so your drag, press, or multi-touch state should reset.
MDN lists common causes: switching apps / Home button, orientation change, palm rejection, touch-action stopping the input, or too many simultaneous fingers. Treat cancel like an emergency stop, not a successful tap.
💡
Beginner tip
For new cross-device UIs, prefer Pointer Events (pointercancel. Keep touchcancel when you maintain Touch Events code or need touch-only behavior.
Concept
Understanding touchcancel
An instance event that answers: “Was this touch aborted before a normal lift?”
Touch points whose state changed (the canceled ones)
touches
All current contact points on the surface
targetTouches
Contacts that started on this event target and are still down
altKey / ctrlKey / metaKey / shiftKey
Modifier keys at event time
Compare
⚖️ touchcancel vs Related Signals
Signal
Meaning
touchstart
Finger(s) touched the surface
touchmove
Finger(s) moved
touchend
Finger(s) lifted normally
touchcancel
Touch aborted / disrupted
pointercancel
Pointer Events equivalent for aborted pointers
Cheat Sheet
⚡ Quick Reference
Goal
Code / note
Listen
el.addEventListener("touchcancel", fn)
Handler property
el.ontouchcancel = fn
Canceled points
event.changedTouches
Cleanup
Reset drag / press UI; do not fire click logic
Cross-device
Prefer Pointer Events + pointercancel
MDN status
Limited availability (not Baseline)
Snapshot
🔍 At a Glance
Four facts to remember about touchcancel.
Event type
TouchEvent
changedTouches
Means
aborted
Not a lift
Bubbles
true
Listen on el
Baseline
no
Limited availability
Hands-On
Examples Gallery
Patterns follow MDN Element: touchcancel event and the Touch events guide. Use a touch device or DevTools touch simulation; some labs include a button that runs the same cleanup handler for desktop practice.
📚 Getting Started
Listen for cancel and read the TouchEvent.
Example 1 — Log touchcancel
Print a message whenever an active touch is aborted.
JavaScript
const pad = document.getElementById("pad");
const out = document.getElementById("out");
pad.addEventListener("touchcancel", (event) => {
out.textContent =
"touchcancel · changed=" + event.changedTouches.length;
});
touchcancel is marked Limited availability on MDN (not Baseline). Logos use the shared browser-image-sprite.png sprite from this project. Touch Events are strong on mobile; many desktop browsers omit them—prefer Pointer Events for cross-device UIs.
✓ Limited availability
Element touchcancel
Fires when touch points are disrupted. Chrome 22+, Firefox 52+, Edge 12+, Safari iOS yes; desktop Safari often no.
PartialNot Baseline
Google Chrome22+ (touch-capable / mobile)
Supported
Mozilla Firefox52+ (desktop re-enabled)
Supported
Apple SafariiOS yes · desktop often no
Partial
Microsoft Edge12+
Supported
OperaMobile / Chromium touch paths
Partial
Internet ExplorerNot supported (use Pointer Events)
Unavailable
touchcancelLimited
Bottom line: Use touchcancel for Touch Events cleanup on mobile. For mouse + pen + touch together, ship pointercancel with Pointer Events.
Wrap Up
Conclusion
touchcancel is the “touch aborted” signal in the Touch Events API. Listen for it whenever you track press or drag state, reset UI on cancel, and consider Pointer Events when you need the same idea across mouse, pen, and touch.
Test with DevTools touch simulation or a real phone
Prefer Pointer Events for new multi-input UIs
Use passive listeners for touchstart/touchmove when you do not call preventDefault
❌ Don’t
Treat touchcancel as a successful tap or click
Leave drag/press styles stuck when a touch is aborted
Assume desktop Safari exposes Touch Events
Detect “mobile” only by checking for ontouchstart
Overwrite ontouchcancel if you need multiple listeners
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about touchcancel
Touch aborted—clean up state, do not count it as a successful lift.
5
Core concepts
📱01
On abort
touch disrupted
Trigger
📄02
TouchEvent
changedTouches
API
⇄03
vs end
abort ≠ lift
Compare
🧹04
Cleanup
reset drag UI
Pattern
🎯05
Limited
prefer pointers
Status
❓ Frequently Asked Questions
It fires when one or more touch points are disrupted in an implementation-specific way—for example the user presses Home, switches apps, the screen rotates, palm rejection cancels input, or touch-action stops the gesture.
No. MDN does not mark Element touchcancel as Deprecated, Experimental, or Non-standard. It has Limited availability (not Baseline), mainly because desktop Safari and some desktop browsers omit or limit Touch Events.
A TouchEvent. Use changedTouches for the touch points that were canceled; also inspect touches and targetTouches as needed.
touchend means the user lifted a finger normally. touchcancel means the system or browser aborted the touch—treat it as cleanup, not a successful tap.
For cross-device UIs (mouse, pen, and touch), MDN recommends Pointer Events. pointercancel is the close cousin of touchcancel for aborted pointers.
Use Chrome Device mode or Firefox Responsive Design Mode with touch simulation. On a phone, press Home or rotate the device while touching the page.
Did you know?
Some desktop browsers hide Touch Events on purpose so sites do not assume “has ontouchstart = mobile phone.” That is a big reason MDN marks Touch Events as Limited availability—not because phones lack touchcancel.