inert HTML global attribute

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2023.

* Some parts of this feature may have varying levels of support.

The inert global attribute is a Boolean attribute indicating that the element and all of its flat tree descendants become inert. The inert attribute can be added to sections of content that should not be interactive. When an element is inert, it along with all of the element's descendants, including normally interactive elements such as links, buttons, and form controls are disabled because they cannot receive focus or be clicked. The inert attribute can also be added to elements that should be offscreen or hidden. An inert element, along with its descendants, gets removed from the tab order and accessibility tree.

Modal <dialog>s generated with showModal() escape inertness, meaning that they don't inherit inertness from their ancestors, but can be made inert by having the inert attribute explicitly set on themselves. No other element can escape inertness.

Note: While inert is a global attribute and can be applied to any element, it is generally used for sections of content. To make individual controls "inert", consider using the disabled attribute, along with CSS :disabled styles, instead.

Inert HTML elements and their flat tree descendants:

  • Do not have click events fired when clicked on.
  • Cannot be focused and focus events cannot be fired on them.
  • Are not searchable via browser find-in-page features (none of their content is found/matched).
  • Disallow users from selecting text contained within their content — akin to using the CSS property user-select to disable text selection.
  • Cannot have otherwise-editable content edited. This includes, for example, the contents of textual <input> fields, and text elements with contenteditable set on them.
  • Are hidden from assistive technologies as they are excluded from the accessibility tree.

The following other features can be used to set an element and its descendants to an inert state:

Accessibility concerns

Use careful consideration for accessibility when applying the inert attribute. By default, there is no visual way to tell whether or not an element or its subtree is inert. As a web developer, it is your responsibility to clearly indicate the content parts that are active and those that are inert.

While providing visual and non-visual cues about content inertness, also remember that the visual viewport may contain only sections of content. Users may be zoomed in to a small section of content, or users may not be able to view the content at all. Inert sections not being obviously inert can lead to frustration and bad user experience.

Examples

In this example, the second <div> and all of its descendants are made inert via the inert attribute:

html
<div>
  <label for="button1">Button 1</label>
  <button id="button1">I am not inert</button>
</div>
<div inert>
  <label for="button2">Button 2</label>
  <button id="button2">I am inert</button>
</div>

Specifications

Specification
HTML
# the-inert-attribute

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
inert
Chrome – Full support
Chrome 102 (Release date: 2022-05-24)
footnote Full support
Edge – Full support
Edge 102 (Release date: 2022-05-31)
footnote Full support
Firefox – Full support
Firefox 112 (Release date: 2023-04-11)
footnote Full support
Opera – Full support
Opera 88 (Release date: 2022-06-08)
footnote Full support
Safari – Full support
Safari 15.5 (Release date: 2022-05-16)
footnote Full support
Chrome Android – Full support
Chrome Android 102 (Release date: 2022-05-24)
footnote Full support
Firefox for Android – Full support
Firefox for Android 112 (Release date: 2023-04-11)
footnote Full support
Opera Android – Full support
Opera Android 70 (Release date: 2022-06-29)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15.5 (Release date: 2022-05-16)
footnote Full support
Samsung Internet – Full support
Samsung Internet 19 (Release date: 2022-11-01)
footnote Full support
WebView Android – Full support
WebView Android 102 (Release date: 2022-05-24)
footnote Full support
WebView on iOS – Full support
WebView on iOS 15.5 (Release date: 2022-05-16)
footnote Full support
Element is ignored for the purposes of find-in-page.
Chrome – Full support
Chrome 124 (Release date: 2024-04-16)
footnote Full support
Edge – Full support
Edge 124 (Release date: 2024-04-18)
footnote Full support
Firefox – Full support
Firefox 120 (Release date: 2023-11-21)
footnote Full support
Opera – Full support
Opera 110 (Release date: 2024-05-14)
footnote Full support
Safari – No support
Safari
footnote
footnote See bug 269909
Chrome Android – Full support
Chrome Android 124 (Release date: 2024-04-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 120 (Release date: 2023-11-21)
footnote Full support
Opera Android – Full support
Opera Android 82 (Release date: 2024-05-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote
footnote See bug 269909
Samsung Internet – Full support
Samsung Internet 27 (Release date: 2024-11-06)
footnote Full support
WebView Android – Full support
WebView Android 124 (Release date: 2024-04-16)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote
footnote See bug 269909

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

See also