User Experience Stack Exchange is a question and answer site for user experience researchers and experts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I started working for a software company, and while using the software we produce, I noticed that the dialogue boxes that we pop-up aren't closed with the [ESC] button.

I'm assuming this would be the default condition of a dialogue box, but I'm unaware if there's any standard that suggest the opposite or this condition to vary.

Could you provide guidance?

share|improve this question
up vote 1 down vote accepted

Closing the dialogue box using a shortcut should only be avalible if the message is not important:

  • Not seeing the whole message will not materially affect the operation of the application.
  • The user can easily recall and bring up that dialogue box again.
  • The content displayed in the dialogue box is a "notification" and does not warn the user that a significant event is about to occur.

If the above circumstances are true, then it is safe to allow the user to close the box using the [ESC] key. This is because [ESC] is often pressed as a reflex to make something go away.

If the dialogue box shows a message asking if the user wants to nuke the system, then binding the [ESC] key to the close action would be inappropriate.

share|improve this answer
Disallowing [Esc] goes against platform standards. Possibly the only scenario in which it is acceptable, is when the dialogue has more than a single button and does not have a default button. Otherwise disallowing [Esc] while [Enter] will automatically take the default, is somewhat futile. – Marjan Venema Jun 18 '12 at 6:12
This is because [ESC] is often pressed as a reflex to make something go away. What do you build this on? – AndroidHustle Jun 18 '12 at 8:44
@edgarator: My main point was that if a message is so important that you do not want the user able to dismiss it too easily, you should not only disable [esc] but should disable [enter] as a means of dismissal as well. Other than that I just think there aren't too many situations that require undismissable user attention as my goal usually is to make sure the app goes on, albeit with possibly limited functionality (which could be conveyed in a top bar or other easily dismissed message). – Marjan Venema Jun 20 '12 at 7:11
Microsoft's guidelines for keyboard user interface design states: " OK or Finish is typically assigned to the ENTER key for a dialog box default action, and Cancel is assigned to the ESC key." Link: – 17 of 26 Jul 25 '14 at 17:17
In my 20 years of experience with Windows, that 'typically' means 'always'. I've never seen the default access keys of Enter and Escape blocked on dialog boxes. Some users live on the keyboard and don't like to touch the mouse. Blocking Enter/Esc is going to irritate these users. – 17 of 26 Jul 25 '14 at 17:20

Presuming you're talking about Windows and WinForms (the classical way of building desktop applications on Windows):

The escape key in Windows sends a click to the dialog's Form.CancelButton property. If you use standard drag-and-drop or simple dialog boxes, the CancelButton will already be specified as the appropriate button in the UI. If you produce custom dialogs/forms, you'll need to add a button for cancelling it, and tell the system that that button represents that form's CancelButton.

In the same way, you can hook up the Enter key to press a given button by specifying that button as the form's DefaultButton.

share|improve this answer
Hi @KitGrose, well, actually I'd like to talk programming-language agnostic, so that it's useful for everyone. However, my application is built in Java Swing... :) – edgarator Jun 19 '12 at 0:43
Right, but the behaviour is only a "default" given certain platforms. For instance Swing implements the DefaultButton property, but not the CancelButton property as a default. – Kit Grose Jun 19 '12 at 2:05
Hence the usability standard that I'm looking for. Something that takes into consideration no programming language, but the user :) – edgarator Jun 19 '12 at 5:53
The user's expectations are defined by convention, generally established by OS providers. We can show you the Apple HIG and MS UX guidelines to show that they suggest hooking up the escape key as a default, but those are conventions of those platforms not rules. If you're targeting some totally unusual platform, the rules may be different (like the backspace key going "Back" in Windows but not in OS X). – Kit Grose Jun 20 '12 at 0:46
Hey @KitGrose stumbled upon The Rule of Least Astonishment, which talks about this. How we should take advantage of previous user knowledge which comes mainly inherited from OS's. :) – edgarator Jun 25 '12 at 1:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.