Skip to content

DLG-003 Name the action on the destructive button and always offer Cancel

Level
Rule
Verdict
Unanimous (3 of 3)
Status
decided, version 1.0.3

Rule

In a dialog that asks the person to confirm a destructive action, label the button that performs it with a verb that names that action, never "OK", "Yes" or another word that does not say what will happen, and always include a button labelled Cancel that is enabled and closes the dialog with nothing changed.

Examples

Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.

Do: The button says what will be lost

Receipts from 2024

340 receipts, kept nowhere else.

Press Delete 2024 receipts. The dialog offers Cancel and Delete receipts: the button states the result on its face, and a screen reader reads the same words. Cancel and Escape close it with nothing changed.

Don't: OK instead of the action

Receipts from 2024

340 receipts, kept nowhere else.

The same dialog with Cancel and OK. To know what OK does, the person has to read the question again. Someone in a hurry presses it and loses a year of receipts.

Don't: No Cancel, only a close icon

Receipts from 2024

340 receipts, kept nowhere else.

The dialog has Delete receipts and a close icon, but no Cancel. The only visible button deletes. The safe way out is a small icon whose result the person has to guess.

Why

A destructive action deletes, overwrites or takes away something the person cannot easily get back. A dialog that checks before such a step only helps if each button says plainly what it will do. "OK" and "Yes" make the person read the question again and work out what the answer means, and people in a hurry skip that step. A button that reads Delete project states the result on its face, and a screen reader user hears the same words. A Cancel button that always works is the other half: there has to be a plain, safe way back, with no doubt about whether leaving will run the action. No WCAG criterion asks for these labels. They help meet WCAG 2.2, 2.4.6 Headings and Labels, and a visible label that is also the button's accessible name supports 2.5.3 Label in Name and 4.1.2 Name, Role, Value. A chance to check before a final step is one of the safeguards that 3.3.4 Error Prevention (Legal, Financial, Data) accepts where it applies. Being able to undo the action is another, and it is often kinder than asking.

Do

  • A dialog titled "Delete the project Autumn 2026?" has the buttons Cancel and Delete project.
  • Use the same verb in the title and on the button: "Remove Jordan Lee from the team?" with Remove. A short verb is enough when the title says what it acts on. Adding the object, as in Remove member, is clearer still.
  • Name the real result: Revoke access, Reset settings, Delete all receipts.
  • Label the safe button Cancel in every such dialog, so people always find the way back under the same word, and let it close the dialog with nothing changed. Escape does the same, as DLG-001 says.
  • If Delete project stays unavailable until the person types the project's name, keep Cancel usable the whole time, and show the text before the button that ACT-005 asks for.
  • Use the visible text as the button's accessible name, so a voice control user can say "Delete project" and a screen reader reads the same words.

Don't

  • Ask "Do you want to delete the project?" with OK and Cancel, or with Yes and No.
  • Put Confirm or Continue on the button that deletes. Neither word says what will be lost.
  • Offer only Delete and a close icon, with no Cancel.
  • Grey out Cancel until something else is done, or let it run any part of the action.
  • Give Delete project an aria-label such as "Confirm" that differs from its visible text.

Exceptions

  • Actions that can be undone. Archiving a project that stays one click away under Archive needs no dialog. Show a message with Undo instead. DST-001b decides when a dialog is needed at all, and DST-001a how Undo is offered. When no dialog is shown, this rule does not apply.
  • While the action runs. After the person has pressed the destructive button and the dialog shows progress, such as "Deleting …", STA-005a covers what Cancel, Escape and the close icon do. Its own choice is that Cancel stops the request only when it can truly be withdrawn, and that otherwise all three are unavailable until the reply.
  • Focus and style. Where focus lands when the dialog opens is covered by DLG-004, and how the destructive button looks by DLG-005.

Verdict

Unanimous (3 of 3). Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work

Stances on DLG-003
SourceRoleStancePage
WCAG 2.2LawSupports2.4.6 Headings and Labels
WCAG 2.2LawSupports2.5.3 Label in Name
WCAG 2.2LawSupports4.1.2 Name, Role, Value
WCAG 2.2LawSupports3.3.4 Error Prevention (Legal, Financial, Data)
Material DesignJudge SupportsDialogs: guidelines
Dialogs: accessibility
Apple Human Interface GuidelinesJudge SupportsAlerts
Buttons
Carbon Design SystemJudge SupportsModal: usage
Button: usage
GOV.UK Design SystemExpert witness No position
Nielsen Norman GroupExpert witness SupportsConfirmation Dialogs Can Prevent User Errors, by Jakob Nielsen

Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.

History

  • Version 1.0.3, : The time while the action runs is now decided by STA-005a.
  • Version 1.0.2, : Examples in English.
  • Version 1.0.1, : The exception for actions that can be undone now points to DST-001a and DST-001b.
  • Version 1.0.0, : First version.

Last checked against the other rules for conflicts on .

More in Dialogs: 5 rules and 2 guidelines · All rules