ACT-003a Put the confirming button last in a dialog's row of buttons
- Level
- Rule
- Verdict
- Unanimous (3 of 3)
- Area
- Actions
- Status
- decided, version 1.0.1
Rule
When a dialog's action buttons sit side by side, put the confirming or primary button last, at the trailing end of the row (the right in left-to-right languages, the left in right-to-left), with Cancel or the other dismissive action before it and no action button after it.
Examples
Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.
Do: Buttons packed at the end
Renew your library loan for two more weeks?
Do: Buttons fill the width
Order 24 photo prints?
Don't: Confirming button first
Join the waitlist for the pottery course?
Why
People learn where the answer to a dialog lives. After a few dialogs, the hand and the eye go to the trailing end of the row for "yes, do it" and look just before it for the way out. If one dialog swaps the two, someone who reads fast presses the wrong button, and in a confirmation that can be the costly one. A fixed order also gives Cancel a fixed place, which FRM-003 asks for. No WCAG criterion asks for any button order, so this rule rests on a convention that the judges share, not on the law. We follow the order all three judges use.
Do
- A dialog titled "Renew your library loan for two more weeks?" shows Cancel and then Renew loan at the trailing end.
- A dialog for ordering photo prints has Cancel and Order prints, packed together at the right edge of the footer.
- The same dialog on a narrow screen lets the two buttons fill the width of the footer, Cancel on the left half and Order prints on the right half. The order is the same, so both layouts are fine.
- A dialog with a single button, such as Done after a short notice, places it at the trailing end.
- In an Arabic or Hebrew interface the whole row mirrors: Cancel on the right, the confirming button on the left. Use logical alignment, such as
justify-content: flex-endin a row that follows the page direction, so the mirroring happens without extra code. - Write Cancel before the confirming button in the code too, so the order screen readers and the keyboard follow matches the order on screen, as LAY-002 asks. Focus in a destructive confirmation still starts on Cancel, as DLG-004 says; being last does not make the confirming button the default.
- If one button is emphasised, it is the trailing one, as ACT-002a allows. In a destructive confirmation the destructive button takes that trailing place, styled as DLG-005 describes.
- If you use shadcn's
DialogFooterorAlertDialogFooter, write Cancel before the confirming button, and check in your own build that the buttons are not shown in reverse when they stack on a narrow screen, since that would break LAY-002 and DLG-004.
Don't
- Put Join waitlist first and Cancel after it.
- Add a third button such as Remind me later after the confirming button, so the action people came for is no longer at the end.
- Reverse the buttons with the CSS
orderproperty orrow-reverseso the screen shows one order and the code another. That breaks LAY-002. - Apply this rule to a full-page form. A page form is a different layout, and this rule does not decide where its main button goes.
Exceptions
- Stacked buttons. When the buttons no longer fit in a row and stack, this rule does not apply. Keep the order of the code on screen, as LAY-002 and DLG-004 say, so Cancel stays first.
- A help control on the Mac. In a dialog styled for the Mac, a help button that explains the dialog may sit apart in the leading corner of the footer, on the same line as the action buttons.
- Multi-step dialogs. In a dialog that walks through several steps, the way out may stand alone at the leading edge, while the buttons that move between steps stay together at the trailing end with the forward one last. A three-step dialog for booking a bike service could have Cancel on its own at the leading edge, and Change bike (back to the first step) and Choose a time at the trailing end.
- A top bar instead of a footer. A sheet or full-screen dialog that puts Cancel at the start of its top bar and the confirming action at the end keeps the confirming action trailing, so it fits the rule.
- Not an exception: a link that leaves the dialog. A link to another page is not a reason to break the row or to place it at the leading edge.
Verdict
Unanimous (3 of 3). Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work
| Source | Role | Stance | Page |
|---|---|---|---|
| WCAG 2.2 | Law | – No criterion applies | |
| Material Design | Judge | Supports | Dialogs: guidelines Buttons: guidelines |
| Apple Human Interface Guidelines | Judge | Supports | Alerts Sheets Buttons |
| Carbon Design System | Judge | Supports | Modal: usage Dialogs Button: usage |
| GOV.UK Design System | Expert witness | No position | |
| Nielsen Norman Group | Expert witness | Opposes, dissenting | OK-Cancel or Cancel-OK? The Trouble With Buttons, by Jakob Nielsen |
Dissenting opinion: Nielsen Norman Group.
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.1, : The single-button example uses Done, as ACT-001a allows.
- Version 1.0.0, : First version.
Last checked against the other rules for conflicts on .
More in Actions: 11 rules and 4 guidelines · All rules
Justified is an independent project. It is not affiliated with, sponsored or endorsed by the organisations whose guidance it cites. Read the full statement.
Apple is a trademark of Apple Inc., registered in the U.S. and other countries and regions.