Favorites

HTML aria-modal ARIA Attribute

aria-modal
ARIA AttributeThis ARIA attribute is supported by all modern browsers.
Updated 28th November 2026

The aria-modal attribute tells assistive technology that a dialog is modal, so content outside it can't be used while it is open.

☕
Enjoying this site?

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

Buy us a coffee

Description

The aria-modal attribute marks a dialog or alertdialog as modal: while it is open, the rest of the page can't be used. Assistive technology may then limit navigation to the dialog's content, so users don't wander into the page behind it.

The attribute only tells assistive technology about the modal behavior; it doesn't create it. Your script still has to move focus into the dialog, keep it there while it is open, close it with Escape and return focus to the control that opened it. Making the background inert is the most reliable way to block it.

The native <dialog> element opened with showModal() does all of this for you and is treated as modal automatically, so it doesn't need aria-modal.

Properties

Type
Widget
Value
true/false
Default
false
Used with
alertdialog, dialog

Syntax

<element role="dialog" aria-modal="true | false">

Values

  • trueThe element is modal.
  • falseThe default: the element is not modal.

Example

<button type="button" onclick="openDlg()">Open dialog</button>
<div id="dlg" role="dialog" aria-modal="true" aria-labelledby="t" hidden
style="position:fixed;inset:20px;background:#fff;border:1px solid #888;padding:16px">
<h2 id="t">Confirm</h2>
<button type="button" onclick="closeDlg()">OK</button>
</div>
<script>
var opener;
function openDlg() { opener = document.activeElement; var d = document.getElementById('dlg'); d.hidden = false; d.querySelector('button').focus(); }
function closeDlg() { document.getElementById('dlg').hidden = true; opener.focus(); }
</script>

Browser Support

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

This ARIA 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