Message and action dialogs include primary buttons which affect the whole window. The order of these buttons, as well as the labels used, are a key part of the dialog.
When a dialog includes an affirmative and a cancel button, always ensure that the cancel button appears first, before the affirmative button. In left-to-right locales, this is on the left.
This button order ensures that users become aware of, and are reminded of, the ability to cancel prior to encountering the affirmative button.
Label the affirmative primary button with a specific imperative verb, for example: Save, Print, Remove. This is clearer than a generic label like OK or Done.
Error dialogs typically include a single button which dismisses the dialog. In this case, a specific action does not need to be referenced, and this can be a good opportunity to use humor. Apology Accepted or Got It are both examples of good labels.
Default action and escape
Assign the return key to activate the primary affirmative button in a dialog (for example Print in a print dialog). This is called the default action, and is indicated by a different visual style. Do not make a button the default if its action is irreversible, destructive or otherwise inconvenient to the user. If there is no appropriate button to designate as the default button, do not set one.
You should also ensure that the escape key activates the cancel or close button, should either of them be present. Message dialogs with a single button can have both escape and return bound to the button.
Binding return and escape in this way provides a predictable and convenient way to continue through a dialog, or to go back.