vocab.design

component

Confirmation dialog

also called confirm dialog (community), are you sure modal (community), destructive confirmation (community)

A modal that stops an action part way through to ask whether you meant it, naming the consequence in its confirm button rather than saying OK.

A confirmation dialog is an interruption with a job: the action is already in flight, and the interface stops it to make sure a person meant what they pressed. That job is only worth doing when the consequence is hard to undo. Anything you can reverse with an undo in a passing message should be reversed that way instead, because a prompt that appears for everything gets dismissed reflexively, and a reflex is not consent.

The wording carries most of the value. A title that states the consequence (“Delete 3 files?”) and a confirm button that repeats the verb (“Delete files”) let a reader answer from the buttons alone. “Are you sure?” with OK and Cancel forces them back up to the title to work out which button does what, and OK is the one people press by habit. Name the safe way out too: “Keep file” beats “Cancel” when the sentence above it already used the word cancel for something else.

Structurally it is a modal dialog with focus moved into it, focus trapped while it is open, Escape wired to the safe answer, and the page inert behind it. Where it differs from a plain modal is the ARIA role: because the dialog interrupts rather than being requested, it is announced as an alert dialog, which asks the screen reader to say it at once. Give it an accessible name from the title and a description from the body, and put the initial focus on the safe button, not the destructive one.

The smaller cousin is the popconfirm, an anchored bubble that asks the same question next to the control instead of taking over the screen. Reach for the dialog when the consequence deserves the full stop, when the question needs more than one line to explain, or when a typed confirmation is warranted. Reach for the bubble when the answer is obvious and the interruption is not.

Which word?

If you wantsay
stopping a destructive action to askconfirmation dialog
confirming in place instead of in a dialogpopconfirm
you must type the repo name to delete ittype to confirm
leaving a form asks whether to discard your editsunsaved changes guard
deleted things go to a bin you can dig them out ofsoft delete
a dialog that announces itself and blocks until answeredalert dialog

Related

Variant of: Modal dialog

See also: Hold to confirm

Implementations

Specimens illustrate the concept; for production use, start here.

aria-apgAlert and Message Dialogs
materialDialogs

Sources