JavaScript Event composed Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

Event.composed is a read-only boolean that tells you whether the event will cross the shadow DOM boundary into the standard (light) DOM after reaching the shadow root (MDN). If it is false, the shadow root is the last node offered the event.

Read the notes below before you rely on this property. Prefer feature detection when support is limited.

Syntax

Use event.composed. Start with this line.

JavaScript
event.composed
CallWhat it does
event.composedPrimary signature.

Built into the browser. Read event.composed on an Event instance — no import required.

Library declarations
JavaScript
event.composed

Parameters

This member has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*The current value of event.composed.

JavaScript Examples

Example 1 — Read composed on a Click

Browser UI events like click are composed — log the flag when the user clicks.

JavaScript
document.getElementById("btn").addEventListener("click", (event) => {
  console.log(event.composed); // true for click
});
Try It Yourself

How It Works

  1. Attach a listener. The handler receives the browser’s click event.
  2. Read the flag. event.composed is true for click.
  3. Meaning. The event can cross shadow roots into the light DOM.
  4. No mutation. Reading composed does not change the event.

Example 2 — composed: true vs Default

Synthetic events default to non-composed unless you opt in.

JavaScript
const soft = new Event("notify"); // default composed: false
const hard = new Event("notify", { composed: true });

console.log(soft.composed); // false
console.log(hard.composed); // true
Try It Yourself

How It Works

  1. Default construction. new Event("notify") uses composed: false.
  2. Opt in. Pass { composed: true } so the event may leave a shadow tree.
  3. Read-only after. You cannot assign event.composed = true later.
  4. Pair with bubbles. For bubbling out, also set bubbles: true.

Example 3 — Dispatch from Shadow DOM

Only a bubbles + composed custom event reaches a listener on the host.

JavaScript
const host = document.getElementById("host");
const shadow = host.attachShadow({ mode: "open" });
const inner = document.createElement("button");
inner.textContent = "Notify";
shadow.appendChild(inner);

host.addEventListener("notify", () => {
  console.log("host heard notify");
});

inner.addEventListener("click", () => {
  inner.dispatchEvent(
    new Event("notify", { bubbles: true, composed: true })
  );
});
Try It Yourself

How It Works

  1. Open shadow. attachShadow({ mode: "open" }) creates an encapsulated tree.
  2. Listen on the host. The light-DOM host listens for "notify".
  3. Dispatch from inside. Options set both bubbles and composed.
  4. Result. The event crosses the shadow root and the host handler runs. Without composed: true, the host would miss it.

Browser Support

Event.composed is marked Baseline Widely available on MDN (since January 2020). It is also available in Web Workers.

✓ Baseline · Widely available

Event.composed

Read-only boolean: true if the event can cross the shadow DOM boundary into the light DOM. Supported in modern browsers; not available in Internet Explorer.

95% Modern browser support
Google Chrome Full support · Desktop & Mobile
Full support
Mozilla Firefox Full support · Desktop & Mobile
Full support
Apple Safari Full support · macOS & iOS
Full support
Microsoft Edge Full support · Chromium
Full support
Opera Full support · Modern versions
Full support
Internet Explorer No support · Legacy
No support
Event.composed Excellent

Bottom line: Safe for modern web apps and Web Components. Read event.composed; set { bubbles: true, composed: true } when synthetic events must leave a shadow tree. Use composedPath() to inspect the path.

Frequently Asked Questions

It is a read-only boolean. true means the event can cross the shadow DOM boundary into the light DOM after reaching the shadow root; false means the shadow root is the last node offered the event.
No. MDN marks Event.composed as Baseline Widely available (since January 2020). It is not Deprecated, Experimental, or Non-standard. It is also available in Web Workers.
No. Browser-dispatched UI events (click, touch, mouseover, copy, paste, and similar) are composed. Most other types are not, including synthetic events created without { composed: true }.
For normal bubbling out of the shadow tree, bubbles must also be true. MDN notes propagation across the boundary only occurs if bubbles is also true. Use composedPath() to inspect the path.
Use new Event("my-event", { bubbles: true, composed: true }), then dispatch it from inside the shadow tree when outer listeners must hear it.
event.composedPath() returns the array of objects the event travels through, including across shadow boundaries when the event is composed. Closed shadow roots may hide inner nodes from the path seen outside.

Next: currentTarget

Learn which element is currently handling the event during propagation.

currentTarget tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful