Skip to content

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

WebKit 4 min read How-to mediumAdept

ElementInternals and Form-Associated Custom Elements

Safari Technology Preview 162 enables ElementInternals and form-associated custom elements by default, letting custom elements set default ARIA roles and labels and take part in form submission and validation. Calling attachInternals() and setting ariaRole avoids the old pattern of adding a role attribute in the constructor, which blocked page authors from overriding it. Declaring static formAssociated = true enables setFormValue, setValidity and reportValidity with native validation UI and :invalid styling. The lifecycle callbacks formAssociatedCallback, formResetCallback, formDisabledCallback and formStateRestoreCallback are also available, though WebKit currently supports only string state and not autocomplete restoration.

Assumes: Custom Elements APIShadow DOMHTML forms

Related posts

  • WebKit Features in Safari 16.0

    WebKit easyNovice

    Safari 16.0 ships AVIF images on iOS, passkeys built on WebAuthn, CSS Container Queries (size queries and cq* units), Subgrid, Offset Path animation, overscroll-behavior, Shared Workers, and Web Inspector Extensions, plus a new Flexbox Inspector. A re-architected macOS accessibility layer (Isolated Tree Mode) moves work off the main thread, serving twice as many requests in 25% less time on complex pages. Sites adopting passkeys should avoid tying sign-in to the device that saved the key and should enable conditional mediation for AutoFill. The release also includes many form, CSP and Web Inspector fixes.

  • Introducing the Dialog Element

    WebKit mediumAdept

    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.

  • An HTML Switch Control

    WebKit mediumAdept

    Safari 17.4 adds a native HTML switch control via `<input type=checkbox switch>`, which falls back to a plain checkbox in browsers without support. It mirrors the checkbox API (`:indeterminate` never matches), uses the ARIA switch role with On/Off announcements and OS accessibility indicators, and supports vertical writing modes. It also honors `accent-color` on the track, and `appearance: none` resets all properties to initial values for full custom styling. Use a switch for on/off settings and a checkbox for selection. Experimental `::thumb` and `::track` pseudo-elements sit behind a feature flag pending standardization.

  • New WebKit Features in Safari 15.5

    WebKit easyNovice

    Safari 15.5 is mostly a polish and bug-fix release, adding three developer-facing technologies: the HTML `inert` attribute, which makes an element non-interactive and hides it from assistive technologies; the CSP Level 3 `worker-src` directive for restricting worker script sources; and WKWebView `minimumViewportInset`/`maximumViewportInset` APIs so apps can support the new CSS small, large and dynamic viewport units. A long list of fixes covers CSS (`position: sticky`, `aspect-ratio`, `background-clip: text`), Web APIs, CSP, media/HLS playback, WebRTC, WebGL multisampling, WebAuthn spec alignment and Safari extensions.

  • 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: