The inert attribute

Block interaction with the page behind a modal.

HTML · The inert attributeAdvanced
<main id="app" inert>
  <h1>Page behind the modal</h1>
  <a href="/x">Not focusable while inert</a>
</main>
<dialog open aria-labelledby="mt"><h2 id="mt">Modal</h2><button type="button">Close</button></dialog>
inertfocusmodalbackground