Should a Dialog Close When Clicked Outside?

Maybe not, but I’ll break these down into three categories because it depends on context and intent.

Pretend this post also applies for pressing Esc.

Action Required

If the user must complete a task that is presented by the dialog, then they should not be able to close it without completing that task — accidentally or not.

Which means it’s probably a modal dialog, otherwise the user could still interact with the underlying page and avoid doing the task. It also probably has no close button, since the user could then avoid doing the task. It also probably won’t close when pressing Esc, since (say it with me) the user could then avoid doing the task.

Possible cases where a user must complete a task before the dialog goes away:

In some cases consider if you’re better off making a standalone page instead of using a modal dialog. Particularly if there is any chance the user may need to access information linked from the footer, from an on-screen error, or otherwise continue navigating the site or reading the underlying page in order to complete the task. This can also better account for when the user hits the Back button when encountering a non-dismissable dialog.

No Action Required

If the dialog is informational, then clicking outside to close it is generally a usability win.

If the dialog is just, like, your opinion man (like it’s your opinion that I need to sign up for your newsletter), then it’s almost always better to allow click-outside-to-close as long as that corresponds with the least destructive choice. Just be sure the user can get back to that accidentally-dismissed free-side-of-ketchup-slices offer.

Cases where it’s probably fine to close the dialog when clicking outside:

Cases where you should definitely allow click-outside-to-close:

Weird Patterns

Maybe you’re using a dialog for some other purpose, like one of the patterns known as drawer, (bottom) sheet, lightbox, or whatever else authors come up with that perverts the UI primitive that is a dialog.

Here you need to make an informed choice based on a combination of user expectation and user impact.

If you have a thing (sheet, drawer, lightbox, sandwich) pop / slide / spin / hoover into place, partly obscuring the underlying page, and the user expects to do stuff in it, then consider:

Because

Login modal with the text, "You're not allowed to see this page, but now you're committed. If you're a good user and log in then we'll let you see it. As a treat." Below the password field is, "If you've forgotten, we can send Chet." where "send Chet" is a link.

Context.

Context means there is rarely a universal answer. Think about intent, expectations, and hassle (to the user, not the fragile ego of an author) when making your decision. Be thoughtful of stress cases for users and mindful of limitations within the platform.

No comments? Be the first!

Leave a Comment or Response

  • The form doesn’t support Markdown.
  • This form allows limited HTML.
  • Allowed HTML elements are <a href>, <blockquote>, <code>, <del>, <em>, <ins>, <q>, <strong>, and maybe some others. WordPress is fickle and randomly blocks or allows some.
  • If you want to include HTML examples in your comment, then HTML encode them. E.g. <code>&lt;div&gt;</code> (you can copy and paste that chunk).