Event.cancelable is a read-only boolean that tells you whether the event can be canceled with preventDefault() so the browser skips its default action (MDN). If it is false, preventDefault() cannot stop that default.
Read the notes below before you rely on this property. Prefer feature detection when support is limited.
Syntax
Use event.cancelable. Start with this line.
JavaScript
event.cancelable
Call
What it does
event.cancelable
Primary signature.
Built into the browser. Read event.cancelable on an Event instance — no import required.
Library declarations
JavaScript
event.cancelable
Parameters
This member has no parameters beyond those shown in the signature.
Return Value
Return Value
Description
*
The current value of event.cancelable.
JavaScript Examples
Example 1 — Read cancelable on a Click
Built-in click events are cancelable — log the flag when the user clicks.
JavaScript
document.getElementById("btn").addEventListener("click", (event) => {
console.log(event.cancelable); // true for click
});
Dispatch a cancelable event. Options set cancelable to true.
Guard. The listener checks event.cancelable before canceling.
Cancel.preventDefault() marks the default as prevented.
Confirm.defaultPrevented is true; dispatchEvent returns false when the default was canceled.
Compatibility
Browser Support
Event.cancelable is marked Baseline Widely available on MDN (since July 2015). It is also available in Web Workers.
✓ Baseline · Widely available
Event.cancelable
Read-only boolean: true if preventDefault() can cancel the event’s default action. Supported across modern browsers and legacy IE.
100%Widely available
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
Event.cancelableExcellent
Bottom line: Safe to use everywhere. Read event.cancelable before preventDefault() in shared handlers. Set cancelable only when constructing synthetic events.
Frequently Asked Questions
It is a read-only boolean. true means preventDefault() can cancel the event’s default action; false means the default cannot be stopped that way.
No. MDN marks Event.cancelable as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard. It is also available in Web Workers.
Call event.preventDefault() in a listener when event.cancelable is true. After a successful cancel, event.defaultPrevented becomes true.
No. cancelable is read-only. For synthetic events, set it with new Event(type, { cancelable: true }). Built-in events get their value from the browser.
MDN notes that some events (for example later wheel events in a sequence) may not be cancelable. Shared handlers should check cancelable before calling preventDefault().
No. bubbles controls whether the event travels up the DOM. cancelable controls whether preventDefault() can block the default action. They are independent flags.