Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

WebKit 4 min read How-to mediumAdept

Introducing the Dialog Element

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.

Assumes: HTML and DOM eventsbasic CSS

Related posts

  • WebKit Features for Safari 27.2

    WebKit mediumAdept

    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. Grid Lanes renames `flow-tolerance` to `fit-tolerance` (old name kept as a deprecated alias); the property sets how close column heights must be to count as tied, and raising it well above the 1em default keeps item order steadier for keyboard users. The release also ships 20 bug fixes spanning accessibility, media/WebCodecs, cookies under CNAME, WebGPU indirect draws, and WebRTC.

  • New WebKit Features in Safari 15.4

    WebKit mediumAdept

    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. Other web platform additions include BroadcastChannel, Web Locks, structuredClone, Array at()/findLast(), Object.hasOwn(), and several Intl API upgrades. Web apps gain manifest-declared icons and ServiceWorker Navigation Preload. Security changes add CSP Level 3 features such as 'strict-dynamic' and remove the XSS Auditor, and many -webkit- prefixed properties now have unprefixed equivalents.

  • Non-interactive Elements with the inert attribute

    WebKit mediumAdept

    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". It replaces piecemeal workarounds such as disabled, tabindex="-1", pointer-events: none and user-select: none, each of which covers only part of the problem. A carousel example uses the inert DOM property in two lines to make inactive slides non-interactive, plus a CSS [inert] opacity cue. Support ships in Safari 15.5, Chrome 102 and Firefox Nightly, with a polyfill suggested for older browsers.

  • The golden rule of Customizable Select

    WebKit mediumAdept

    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. The one essential rule is to always give each `<option>` text content or an accessible text attribute. Icon-only options are harder for everyone to scan, unusable with screen readers and braille displays, and render as empty options in browsers without support or when CSS fails to load. Use visually hidden text or `alt` attributes where needed, mark decorative images with `alt=""`, and wrap enhancements in `@supports (appearance: base-select)` so plain text stays the baseline.

  • In March, we see Firefox 87

    Mozilla Hacks mediumAdept

    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. DevTools gains prefers-color-scheme light/dark emulation and a :target pseudo-class toggle. The default Referrer-Policy becomes strict-origin-when-cross-origin, so paths and query strings are no longer sent cross-origin. SmartBlock substitutes bundled stand-ins for blocked tracking scripts so sites keep working, and VoiceOver screen reader support now ships on macOS.

The quest for software engineering knowledge.

Look:
Layout: