Overlays

Dialogs, popovers, and menus, opened without JavaScript where the browser allows it.

Dialog

A modal dialog sits on the overlay surface over a blurred backdrop, and the page behind it doesn't scroll, except in Safari. Under prefers-reduced-transparency, the backdrop darkens instead of blurring.

Dialog title

A modal dialog on the overlay surface with a blurred backdrop.

Accessibility

Open it with a button's commandfor and command="show-modal", or showModal() from script, so focus moves into it and Escape closes it. Label it with aria-labelledby. closedby="any" also closes it on a click outside, where supported; leave it off a dialog that holds unsaved input.

Customize

It scales in, unless motion is reduced.

Popover

A popover opened by a popovertarget button, with no JavaScript.

A popover opened with popovertarget, no JavaScript needed.

Accessibility

Escape and a click outside close it, and the button tells screen readers whether it's open.

Customize

It slides up into place, unless motion is reduced.