I thought that most destructive actions should be avoided from default actions. But when a delete dialog comes, I see that most Windows applications (even the OS), by default, set the focus at "Yes"/"Delete" button. On Mac OS X, instead, I see the following at their design guidelines:

...

Avoid providing click-through for an item or action whose result might be dangerous or undesirable. Specifically, avoid enabling click-through for an item that:

3 Answers
3

I think the answer to whether the destructive "delete" should be the default action or not highly depends on the context in which the dialog occurs. If the dialog was the result of an action that expresses a clear destructive intent, like for example clicking "empty trash", the user probably knows what the consequences are, so it makes most sense to have the affirmative "yes, I really want to empty the trash" confirmation be the default action (enter confirms, space or escape cancels):

In such cases it could potentially be very annoying if there is no easy way to confirm the action that the user just performed ("yes, of course I want to empty the trash, I just clicked that, didn't I?!").

If, on the other hand, the dialog occurs to warn the user of a potentially destructive side effect of something they did, it makes more sense to err on the side of caution. A good example of this is the dialog that occurs when you close an unsaved document. In that case it is unclear if the user intended to abandon the changes, so the destructive action is not the default:

So, even though Apple's Human Interface Guidelines on dismissing dialogs states "Use a default button only if the user’s most likely action is harmless", I would say: use a default button only if the user’s most likely action is harmless and is not a clear extension of the action that triggered the dialog (e.g. it's almost impossible to empty the trash by accident, but it would be bad to accidentally lose all changes in a document after closing a window).

Would that not cause consistency issues though? Sometimes the default is to delete, sometimes it is to not-delete.
–
JonW♦Jan 21 '13 at 12:23

1

I was thinking about that too, but I think there is still consistency here, albeit at a more detailed level. A consistent "rule" of "the default action is never delete" causes frustration when the user intends to delete. As long as users can assume "delete is default when I perform a clear delete, but not when something else I do might be destructive", I think that is consistent enough.
–
Michel JansenJan 21 '13 at 12:34

I think the rule is "The default selection is the confirmation of the user's action". i.e. if the user presses delete then the confirmation will have delete as the default. If the user tries to save over a file that already exists then "save" is the default with "delete there also". Either way it is the confirmation of the action that is default.
–
FogmeisterJan 21 '13 at 13:13

Yes, that's actually a clearer way of putting it. The exception then becomes when deletion is not a clear result of the user's action, e.g. closing a window does not guarantee the user wishes to abandon changes, so rather than "confirm delete" the question becomes "confirm close -> save or delete?".
–
Michel JansenJan 21 '13 at 13:28

Good answer, seems like the approach of making the default button the action that triggered the dialog is better for user experience than my first thoughts. Anyway, I think there are exceptions to that rule, for example, when I present a dialog to update the firmware of a device, and it will format all the data, I think press enter to start is very dangerous. Maybe we can add that, when the dialog makes secondary actions that the user must be aware, it should focus the safest option first anyway.
–
dbalboaJan 22 '13 at 8:25

If the application is an Enterprise application, then it would mean that person would be using it on daily basis, and would know what he/she is doing. On next 'Enter' key press, they would like to action to be confirmed. However, if you are too concerned about data being deleted accidently, then let the deleted content go to a 'Trash' box in your application from where it could be recovered again. But if a user is expected to use the application to make a living on daily basis then focus should always be on 'Yes'

If the application is a casual application and expected to be used in a leisure time, then unless and until the delete is triggered by a gesture rather than a click/tap, don't put the focus on 'No'. If the delete is triggered by a hover or anything else, then focus should be on 'No' or 'Cancel' always, else put it on 'Yes'.

Its a good point to think that if the application will be used regularity by users that knows how to work with it, you should think about it and take it in consideration. The problem is that this ideal situation wont happens most times ;)
–
dbalboaJan 22 '13 at 8:30

@dbalboa Why do you think it is an ideal situation? If I am using Windows OS on daily basis, I would know what 'Delete' button is meant for. And I am anyways showing the dialog box once he user presses 'Delete' button or selecting 'Delete' option after right click, so there is no risk also.
–
ripu1581Jan 22 '13 at 8:40

I mean that most applications have to cover users without experience with computers. I think the checked answer fits the question that i asked, anyway, your point of view is good too.
–
dbalboaJan 22 '13 at 9:23

Giving automatic focus to "Yes" button, could result in accidental deletion of file.
On the other hand, giving automatic focus to "No" button could cause the user to swiftly delete several files and then notice that none of them have been deleted and start over.

I wouldn't set either as default or focused. Instead, I would make the text focusable if necessary, so the user must choose an action (either using mouse, or by pressing on tab and space/enter or by pressing on excelerator key (e.g. 'Y' or 'N').

I would set the "No" button as the "cancel" button (responsive to ESC key).