In JavaScript, the transitioncancel event fires when a CSS transition is canceled (MDN)—after transitionrun and before a normal transitionend. The event object is a TransitionEvent. If transitioncancel fires, transitionend will not fire for that transition.
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Syntax
Listen for transitioncancel. Start with this line.
JavaScript
el.addEventListener("transitioncancel", fn)
Call
What it does
el.addEventListener("transitioncancel", fn)
Primary signature.
Built into the browser. Listen with el.addEventListener("transitioncancel", …) — no import required.
Library declarations
JavaScript
el.addEventListener("transitioncancel", fn)
Parameters
Parameter
Description
Event target
Required. Element whose CSS transition was canceled
Attach both listeners. Cancel and end are separate outcomes.
Abort path. Reverse the transition early → only transitioncancel runs.
Finish path. Let it complete → only transitionend runs.
MDN rule. If cancel fires, end will not fire for that transition.
Compatibility
Browser Support
transitioncancel is Baseline Widely available on MDN (across browsers since November 2020). It is a standard CSS Transitions event, not Deprecated or Experimental.
✓ Baseline · Widely available
Element transitioncancel
Fires when a CSS transition is canceled. Supported in modern Chrome, Firefox, Safari, and Edge.
95%Modern browser support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
transitioncancelExcellent
Bottom line: Safe to use in modern web apps. Pair with transitionend when you need both abort and finish paths.
Frequently Asked Questions
It fires when a CSS transition is canceled—after transitionrun has occurred and before a normal transitionend (MDN). Common causes include reversing a hover early or removing the class that drove the change.
No. MDN does not mark Element transitioncancel as Deprecated, Experimental, or Non-standard. It is Baseline Widely available (across browsers since November 2020).
A TransitionEvent. Useful read-only properties include propertyName, elapsedTime, and pseudoElement.
transitionend fires when a transition finishes its intended run. transitioncancel fires when the transition is aborted early. If transitioncancel fires, transitionend will not fire for that transition.
If there is no transition delay or duration—both are 0s or neither is declared—there is no transition, and none of the transition events fire.
Prefer element.addEventListener("transitioncancel", handler). You can also set ontransitioncancel where supported.