Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

inert

Make a subtree unusable: no focus, no clicks, no text selection and hidden from screen readers, while it stays on screen. Covers what inert does not do, and how it differs from hidden and disabled.

Overview

The inert attribute switches off an element and everything inside it. Inert content can't be focused or clicked (pointer events pass through as if it had pointer-events: none), is removed from the accessibility tree, and may be skipped by find-in-page and text selection. It is still rendered: the browser adds no visual change at all.

It is what a modal <dialog> does to the rest of the page, made available for any subtree: off-screen drawer panels, collapsed regions, content behind your own overlay.

Applies to: any HTML element (it is a global attribute).

Values

ValueMeaning
Present (inert, inert="", or any value)The element and all its descendants are inert.
AbsentNot inert (the default), unless an ancestor is inert or a modal dialog is open elsewhere.

It is a boolean attribute, so inert="false" still makes the element inert. Remove the attribute, or set the inert property to false. A descendant can't opt back out of an inert ancestor.

Examples

Style it yourself

Because nothing changes on screen, sighted users see controls that ignore them. Give inert regions a visual cue. Muted text keeps contrast readable; opacity usually drops it below WCAG AA.

Off-screen panels

A drawer or slide that is moved out of view with a transform is still focusable. Make it inert while it is out of view, and remove the attribute when it slides in.

Behind a modal: nothing to do

showModal() and command="show-modal" already make everything outside the dialog inert, and restore it on close. Adding inert to <main> yourself is only needed for a home-made overlay that isn't a modal <dialog>.

In Vanilla Breeze

  • No global styling. VB has no [inert] rule, matching the browser.
  • Table rows. tr:is([data-disabled], [inert]) gets muted text and no hover highlight, and GrayText in forced-colours mode (src/native-elements/table/styles.css). Use data-disabled for the look alone and inert when the row's controls must also stop working.
  • data-show-when / data-hide-when give a hidden section hidden and inert, and disable its controls (src/utils/conditional-init.js).
  • data-spoiler keeps concealed content inert until it is revealed (src/utils/spoiler-init.js).
  • <split-surface> makes a collapsed panel inert so its controls leave the tab order.
  • data-hotkey doesn't fire a shortcut whose target is inside an inert or hidden subtree.
  • data-toggle="inert" flips the attribute from a button, as in the demo.

Accessibility

  • Inert content is hidden from screen readers. Only use it on content nobody needs to read right now. For a form section that should stay readable but can't be changed, use readonly, disabled or aria-disabled="true", which are announced.
  • Pair inert regions with a visible cue and, where it isn't obvious, a reason ("Owner can't be removed"). Otherwise the screen shows content that keyboard and screen reader users can't reach and mouse users can't use.
  • If the focused element becomes inert, focus is lost and falls back to the document. Move focus somewhere useful first.
  • Prefer the platform's own modality: a modal <dialog> manages inertness, focus and Escape together.

Browser support

inert: Baseline 2023 (Chrome 102, Firefox 112, Safari 15.5). Skipping inert text in find-in-page: Chrome 124 and Firefox 120; Safari still finds it (as of November 2026).

Gotchas

  • No visual change. An inert form looks fully usable. Style it.
  • Not the same as disabled. Inert form controls are still submitted with the form and still take part in validation, so a required inert field can block submit. Disable controls you want left out, as data-show-when does.
  • Boolean. inert="false" is inert.
  • It blocks the user, not your code. element.click() from script still dispatches a click on inert content. Only focus() fails, because inert elements can't take focus.

Related

Which to choose

  • hidden — the content shouldn't be shown at all right now.
  • inert — visible for context, but nobody should use it and screen readers should skip it.
  • disabled — a form control that can't be used and shouldn't be submitted; announced as unavailable.
  • aria-disabled="true" — a control that stays focusable so users can find it and learn why it's unavailable; you block the action in script or with data-loading.
  • readonly — a field whose value can be read, focused and submitted, but not changed.
  • A modal <dialog> — the whole page except one task should be unavailable.
↑