Currently the delete confirmation dialog has this:

Are you sure you want to delete?
     Yes         Cancel

Should there be a close [x] icon at the top right for the delete confirmation dialog? Is it a best practice?

  • 35
    Slightly tangential, but this is not a good example of a confirmation dialog. Buttons should generally have active verbs that match the message, so in this case, "Delete" and "Cancel". Buttons that just say "Yes", "No", "OK", "Cancel" lead to mis-clicks, due to people's laziness in reading the messages to which they refer.
    – calum_b
    Commented Sep 22, 2015 at 15:14
  • 1
    Also due to unclear messages and, sometimes, to contradictory statements in the dialog title and message.
    – Édouard
    Commented Sep 22, 2015 at 18:05
  • 1
    i don't know that i quite agree with scottishwildcat : "Yes" is fine for this dialog, if the user can read the question. Plus, most apps go the extra mile, so the user need scarcely think before they click. the close [x] icon is the fav bailout for all. it's not just universal, it's unanimous. Commented Sep 23, 2015 at 4:41
  • 4
    Why not have the "undo" action instead of confirmation boxes?
    – UXerUIer
    Commented Sep 23, 2015 at 15:32

6 Answers 6


Besides the scenarios of an application spawning lots of dialogs and the user trying to deal with them in a hurry, there is another perfectly legit situation:

What if the user doesn't understad your question? Where should they click?

Imagine your app happens to ask a musician wheteher it should rebase samples repository. Or your app gets translated to Spanish by someone lasy, and the dialog with a crystal-clear question doesn't make much sense anymore. My point is, no matter how careful you are when designing the UI, you cannot be sure that your users will never see a dialog which (in their eyes) reads

Do you want me to screw up your work?
     Probably         Maybe

No matter how much time (within reason) the user will spend on this, his choice will not get any safer. This is why you need to provide an alternative answer which would be safe in most cases. It will not be 100% safe (it cannot be), but it should be better than clicking at random.

Now this is where the X button comes in handy. It will be readily perceived as a safe escape by most users, and it will be accessible to people who cannot, or are not comfortable with, hitting Esc on the physical keyboard (which should produce the same result).

It doesn't have to be big, mind you. You don't want to encourage users to click on it when they are capable of making an educated choice. But it should be there.


People sometimes just close the confirmation/warning dialogs without reading the content.

Removing the [X] button will somehow force the users to read the message in order to know whether to press [yes] or [cancel]. This is of course the purpose of a modal dialog and it would seem the right thing to do.

This may cause frustration for users that are in a hurry, especially if the system is constantly popping up dialogs in all kinds of irrelevant situations.

My recommendation is to remove the close button only if your system uses dialogs with care, only when they are absolutely needed. This way your users will be surprised to see one and understand it is something important that needs to be treated with attention.

  • 2
    Although, I agree with some of your points - The importance of consistency should not be forgotten. In any way - modals should only be used when they are absolutely needed, and therefore, getting rid of the x completely would follow this pattern. (People will not "be surprised too see one and understand it"...)
    – Velkommen
    Commented Sep 22, 2015 at 9:34
  • 1
    If the user is in a hurry, they're unlikely to want to target and click on the smallest button on the page -- the 'X' button. They'll more likely click the bigger 'Cancel' button, or just press Escape.
    – calum_b
    Commented Sep 22, 2015 at 15:16
  • 2
    @scottishwildcat This is not about the target size. In order to decide which one to click, you need to read the message to make an informed decision. You cannot click yes or no without understanding the question. You can anticipate the question, given the context, but that doesn't always work because some of the questions are weird and use double negation and so on. Regarding the escape key, this would also be disabled when removing the [X] button. The goal is to force the user to read the message and give an input. If the input is not absolutely required, just make the dialog non modal. Commented Sep 22, 2015 at 16:06
  • this is a nice answer and the logic is sound, although I'm not completely fond on denying affordances. I know it's kinda trendy now, but I'd rather work on copy or different approaches that to deny affordances. +1 anyways for a nice answer and food for thought
    – Devin
    Commented Sep 22, 2015 at 17:56
  • 1
    If I need to drop the application, I punch X buttons or press Alt-F4 until the whole application goes away. X on a confirm box == Cancel. (This way I don't bother reading boxes.)
    – Joshua
    Commented Sep 22, 2015 at 19:19

Do always provide an X-Button unless you really need a distinct answer. Most people assume that clicking the X gets them back where they started without the need to answer the probably confusing question of the application. Most users who understand what they just did will choose an option, all others might click the X, that's my experience.

See this Question for another discussion in this topic.

  • 1
    Welcome to the site, @jonas! At the moment, this post reads as opinion. Is there any evidence you can provide to support it? (You mention "that's my experience." Can you clarify what this experience was? Have you run a study where participants clicked the X? Is there any data you can share?) Commented Sep 22, 2015 at 15:38
  • 1
    Things have been said about the "importance" of the dialog. Importance, for whom? Albeit the site owner might care about the answer, there are also users who couldn't care less and would like to dismiss the modal dialog in an hygienic fashion and leave. A good approach is to use the [x] button, which is supposed to do nothing but clearing the dialog. IMO the button is the escape way for the non-committed.
    – Juan Lanus
    Commented Sep 22, 2015 at 22:12
  • Example for a distinct answer might be the German "Buy Now" button which has to be a specific text like "Zahlungspflichtig bestellen" you might be forced by law or other regulations to have your user click Cancel some times. X would not be a suitable option then. Commented Sep 23, 2015 at 9:54

The cancel button is usually used for something the user called.

if the dialog is a missclick, the user might just want to press the red x at the top since thats the first thing his eyes see when wanting to get out of an operation.

pressing [x] is like being asked a question and answering "no comment" and going away. if thats not a possibility in your dialog you might want to disable it after all.


If one of the options you are presenting to the user is Cancel, then you should also have a close button [x] as this is identical to pressing the cancel button.

If you don't have the option of cancelling ie Yes/No, then you should not have an [x] because it is unclear what this will do. At this point the user is committed to doing something so they must choose yes or no.


Personally, just looking at the message you're providing:

Are you sure you want to delete?

To me, clicking the [x] would be equivalent of not giving any response if you were asked that in fleshspace.

So, what would your reaction be in the real world? Ask the question again, or not perform the action? If it's the former, don't include an [x] since it's not a viable response; on the other hand, if you'd just not delete it if the person ignored you, then include one.

I suppose really the answer depends on what you're deleting and when, but in most contexts I'd be inclined to repeat the question (ie no [x])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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