This pattern should not be used. While confirmation dialogs can prevent user errors (if they are not overused), they are a perfect example of an enhancement. Enhancements are not features that are unimportant, but features that are not critical. Confirmation dialogs can prevent costly errors if properly used, but a system without confirmation dialogs will still function. The window.confirm()
method might fail if a problem occurs with JavaScript, but that is acceptable. It uses an interface familiar to the user, and that familiarity can prompt her to recognize that she’s being asked to commit to an important decision. A custom-designed prompt like this one might look “better” but is not as well-designed because it fails to fulfill that need as well because it is less familiar and thus less recognizable.
Allowing users to undo a destructive action is, in general, a far better design pattern than requiring a confirmation. Any time you implement a confirmation dialog, try to find some way that you could provide an opportunity to undo the action instead. Use a confirmation dialog only if there truly is no way to provide an option to undo the action.
Use confirmations for actions that have serious consequences. Never use them for routine actions, or users will become too accustomed to dismissing them, which will defeat their purpose.
The heading for the confirmation should be specific. Never use, “Are you sure?” Instead, specify the action in question. Likewise, the text should also be specific, detailing what the consequences of the action will be. The text of the buttons should also be specific about the action that will take place if the user clicks them (e.g., use “Delete” rather than “Yes”).
When asking for a confirmation, do not select either option as the default. Confirmations should only be used for actions that have serious consequences, and if the consequences are that serious then we want to make sure that the user takes a moment to consider and act deliberately. Default choices reduce friction, making it easier for a user to proceed along the most likely route. In this case some friction is desired, because it gives the user occasion to pause and consider what she is about to do. That is the goal of this pattern. If the confirmation dialog is not to confirm anything but to gather extra information, then you can designate a default option (but if that’s the case, then this threatens to over-use the pattern, undermining its efficacy and violating previously-stated principles).
The confirmation dialog uses the same subclasses as the banner pattern, but rather than info
, its default is warning
, and it does not include the confirmation
subclass. Setting info
, approved
, or error
will set the corresponding icon. The info
subclass should be used when the confirmation dialog is being used to gather additional information, as in the second example.