Confirmation dialogs that people can trust
When a confirmation is justified
A confirmation dialog interrupts the person and asks them to stop and think. That interruption is worth it only when the action is hard or impossible to reverse, affects other people, or has a real cost, such as deleting a project or paying for a plan.
For small, reversible actions, a dialog only adds friction. If every action asks “Are you sure?”, people stop reading and click through, including the one time it matters.
- Ask: can the action be undone, and how costly is a mistake?
- Ask: is the action triggered close to other controls where a slip is likely?
- If both answers point to risk, a confirmation is justified. Otherwise look for another solution.
A dialog is also a weak safeguard on its own. People who act quickly will confirm without reading, so the text and button design have to make the consequence hard to miss.
Prefer undo when you can
Undo is often a better design than confirmation. The action happens immediately, and a short message offers a way back, for example “Message deleted. Undo”. People keep their flow, and mistakes are still recoverable.
- Use undo for deleting items that can be kept briefly in a trash or archive.
- Keep the undo message visible long enough to read and reach, and make it keyboard accessible.
- Use a confirmation when undo is not technically possible, such as permanent deletion.
Write a specific dialog
A generic “Are you sure? Yes / No” forces people to re-read the question and guess what each button does. A good dialog names the object, states the consequence, and uses buttons that describe the actions.
Title
“Delete project “Spring campaign”?”
Consequence
“All 24 files and comments will be permanently removed. This cannot be undone.”
Safe button
“Keep project”
Destructive button
“Delete project”
A person should be able to understand the choice from the buttons alone.
Styling and behaviour
- Style the destructive button differently, often with a red or strong colour, but never rely on colour alone: the label must carry the meaning.
- Let Esc close the dialog and choose the safe option. Do not make the destructive action the default for Enter.
- Move focus into the dialog when it opens, keep it inside while open, and return it to the triggering control when it closes.
- Avoid dialog fatigue: confirm rarely, group related actions, and never stack several dialogs in a row.
For very high-risk actions, such as deleting an account, ask the person to type a name or word to confirm. Use this rarely, because it adds real effort.
Sources
- W3C. WAI-ARIA Authoring Practices Guide, Dialog (Modal) Pattern. https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
This guide was drafted with AI assistance from public standards and references. For the exact wording of a standard, use the sources listed above.