Favorites

HTML shadowrootdelegatesfocus Attribute

shadowrootdelegatesfocus
HTML AttributeThis attribute is supported by all modern browsers.
Updated 22nd November 2026

The shadowrootdelegatesfocus attribute passes focus from a shadow host to the first focusable element inside its declarative shadow root.

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee

Description

The shadowrootdelegatesfocus attribute is a boolean attribute of the <template> element. It only has an effect together with shadowrootmode, and sets the delegatesFocus property of the declarative shadow root: when the host is clicked or focused, focus is passed to the first focusable element inside the shadow root, and the host matches :focus.

Declarative Shadow DOM lets a web component's shadow root be written directly in HTML: a <template> element with the shadowrootmode attribute, placed inside the host element, is turned into a shadow root by the HTML parser. This makes it possible to render components on the server, with their encapsulated styles, without waiting for JavaScript.

Syntax

<template shadowrootmode="open" shadowrootdelegatesfocus>

Values

  • shadowrootdelegatesfocusA boolean attribute; its presence enables the option on the declarative shadow root.

Applies To

Example

<div class="card">
<template shadowrootmode="open" shadowrootdelegatesfocus>
<style>p { color: #4361ee; font-weight: bold; }</style>
<p>Styles inside the shadow root are encapsulated.</p>
<slot></slot>
</template>
<span>Slotted light DOM content</span>
</div>
Open in editor

Browser Support

The following information will show you the current browser support for the HTML shadowrootdelegatesfocus attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.

This attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee