---
title: "Introducing the Dialog Element"
description: "Safari 15.4 beta and Safari Technology Preview 134 add the HTML `<dialog>` element, a native, accessible replacement for the script-blocking `alert`, `confirm` and `prompt` methods and for framework-built modals."
url: "https://swe.quest/articles/introducing-the-dialog-element-9af9ed3251b7cd00"
canonical: "https://webkit.org/blog/12209/introducing-the-dialog-element/"
source: "WebKit"
published: "2022-02-07"
difficulty: "medium"
kind: "How-to"
reading_minutes: 4
tags: ["browsers","frontend","accessibility","css"]
---

# Introducing the Dialog Element

A post on [WebKit](https://swe.quest/sources/webkit.md), published 2022-02-07, 4 min read, How-to. Original: [https://webkit.org/blog/12209/introducing-the-dialog-element/](https://webkit.org/blog/12209/introducing-the-dialog-element/)

## Summary

Safari 15.4 beta and Safari Technology Preview 134 add the HTML \`\<dialog\>\` element, a native, accessible replacement for the script-blocking \`alert\`, \`confirm\` and \`prompt\` methods and for framework-built modals. Modal dialogs open with \`showModal()\`, lock interaction to the dialog and render above all content regardless of z-index. Non-modal dialogs open with \`show()\`, and both close with \`close()\`. \`\<form method="dialog"\>\` closes the dialog on submit and sets \`returnValue\`. The backdrop is styled through \`::backdrop\`, and the element maps to \`role="dialog"\`/\`aria-modal\`, closes on Escape via a \`cancel\` event, and honors \`autofocus\`. Toggling the \`open\` attribute by hand is discouraged because it bypasses focus handling, and initial-focus behavior and the \`inert\` attribute are still being made interoperable under Interop 2022.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Browsers](https://swe.quest/tags/browsers.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [Accessibility](https://swe.quest/tags/accessibility.md) (Web & mobile)
- [CSS](https://swe.quest/tags/css.md) (Web & mobile)

## Prerequisites

- HTML and DOM events
- basic CSS ([easy posts on CSS](https://swe.quest/tags/css.md?difficulty=easy))

## Keywords

\<dialog\>, Safari 15.4, Safari Technology Preview, ::backdrop, inert attribute, Interop 2022, WebKit

## Related posts

- [WebKit Features for Safari 27.2](https://swe.quest/articles/webkit-features-for-safari-27-2-f545f4ccec69d87b.md): WebKit · 2026-10-26 · Medium · 5 min read · Browsers, CSS, Frontend, Accessibility
  Safari 27.2 refines Customizable Select with a new \`::field-content\` pseudo-element for styling the displayed selected option without \`\<selectedcontent\>\`, adjusts \`appearance: base-select\` UA styles (flex-based button spacing, inherited \`text-overflow\`, simpler \`::picker-icon\`), and uses \`safe\` alignment so large pickers stay within the viewport.
- [New WebKit Features in Safari 15.4](https://swe.quest/articles/new-webkit-features-in-safari-15-4-378317c134d40474.md): WebKit · 2022-03-14 · Medium · 13 min read · Browsers, CSS, Frontend, JavaScript
  Safari 15.4 ships over 70 WebKit additions, led by the \<dialog\> element with ::backdrop, lazy-loaded images, the :has() parent selector (shipped first in Safari), Cascade Layers, CSS containment, and new small/large/dynamic viewport units (svh, lvh, dvh and friends) that fix mobile viewport sizing.
- [Non-interactive Elements with the inert attribute](https://swe.quest/articles/non-interactive-elements-with-the-inert-attribute-966ae3b60cf7bc71.md): WebKit · 2022-04-26 · Medium · 3 min read · Browsers, Accessibility, Frontend, CSS
  The HTML inert attribute disables focus, clicks, text selection and editing on an element and its descendants, and hides them from assistive technologies like aria-hidden="true".
- [The golden rule of Customizable Select](https://swe.quest/articles/the-golden-rule-of-customizable-select-f338a360afa66726.md): WebKit · 2026-06-15 · Medium · 3 min read · Accessibility, CSS, Browsers, Frontend
  Customizable select, arriving in Safari 27, lets developers fully style \`\<select\>\` elements with custom arrows, icons and swatches while keeping native keyboard navigation and accessibility semantics.
- [In March, we see Firefox 87](https://swe.quest/articles/in-march-we-see-firefox-87-89133003c9c65b13.md): Mozilla Hacks · 2021-03-23 · Medium · 4 min read · Browsers, Privacy, Developer tools, Accessibility
  Firefox 87 enables the beforeinput event and InputEvent.getTargetRanges() by default, letting web apps inspect and cancel text edits in inputs and contenteditable elements before the DOM changes, with an example that protects metadata spans inside an editable comment.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
