Skip to main content

HTML Standards: The Dialog Tag

SimpleAccess.io Elements Series

Elements Index

The <dialog> Element

As defined in the HTML Living Standard, the <dialog> element represents a dialog box or other interactive component, such as a dismissible alert, inspector, or sub-window.

Visual Example:

Confirmation

Are you sure you want to proceed with this action?

<dialog id="my-dialog"> <h3>Confirmation</h3> <p>Are you sure?</p> <button onclick="this.closest('dialog').close()">Close</button> </dialog> View HTML Living Standard: The dialog element

Modal vs. Non-Modal

The <dialog> element can be opened in two distinct ways:

WCAG Requirement: Focus Order

Success Criterion 2.4.3 (Level A): Focus order must be logical and intuitive.

When using showModal(), the browser automatically handles "focus trapping." This means the Tab key will only cycle through elements inside the dialog, preventing the user from accidentally tabbing into the background page. This is a critical accessibility feature that previously required complex JavaScript.

Understand SC 2.4.3: Focus Order

Accessibility Best Practices

To ensure your dialogs are fully accessible, follow these rules:

A11y Tip: The Backdrop

When a modal dialog is open, browsers provide a ::backdrop pseudo-element. You can style this to dim the background, which helps users with cognitive disabilities focus on the active task by reducing visual noise.

© 2026 SimpleAccess.io — Native Standards for Everyone.