There is a page, which can be edited by the user, and there are two actions - Save and Cancel.

Would it be appropriate to show some kind of alert, once the user accidentally pressed Cancel after making some changes?

  • 1
    I mean... Stack exchange does this.. Try writing an answer then leaving the page before submitting it.
    – UXerUIer
    Commented Sep 28, 2016 at 13:42
  • but leaving a page (implicit) is not the same as pressing cancel (explicit) Commented Jul 22, 2019 at 11:37

4 Answers 4


It heavily depends on the damage (or lost time) that the user has to face with the "Accidental Cancel" (or even "Accidental Ok")

If it means that the user would lose more than 10 minutes (or 2 days for some financial transactions), then I would ask for confirmation.

It it means that the user has to fill-in his first name, last name, age again after an accidental cancel, there is not much benefit in confirming.

Trying to configure the behaviour of "Accidental Cancel" will add complexity to the problem. It will still be useful, but only if the user is a power-user who uses the site repeatedly, almost everyday (For ex., if he is an operator of a shopping terminal doing the billing for customers). For a power-user, it is worth to give every single trick in the book to speed up his work.


Short answer - humans are not robots and make mistakes. They click things by accident.

If you can detect that they have made some changes it is often a good idea to display a warning that those changes will be lost.

To make the whole experience cleaner you can include a "don't warn me about this next time" checkbox in the warning message, for those users who don't want to be warned about this if it happens again (this addresses the valid point raised by colmcq).

  • The same can be said for the save button in my opinion, someone might want to undo the changes by pressing cancel and accidentally press save.
    – MJB
    Commented Sep 28, 2016 at 10:42
  • Save is not a destructive feature so there is no harm caused - Cancel can be destructive (you lose any changes you made). However, Undo can be a very useful feature to consider in the design too.
    – SteveD
    Commented Sep 28, 2016 at 10:50
  • If you changed something and you find out it's wrong or you have doubts about the changes, saving them (meaning the previous settings are lost) can be just as destructive as simply pressing cancel, or do you disagree? By the way, I agree with your answer, I just added that it goes both ways.
    – MJB
    Commented Sep 28, 2016 at 11:38
  • @MJB I agree - good point. This was why I added the note about the Undo feature - I have seen a lot of teams baulk at the thought of additional work to implement an Undo feature, yet it is so useful in these edge case situations.
    – SteveD
    Commented Sep 28, 2016 at 11:46
  • 1
    @RomanPavlyk That is one approach for the accidental click Click Cancel. - you would definitely need to think through how you would implement Undo for the accidental click on Save though - In the enterprise applications I design, we always display a save confirmation message which slowly fades out (so no extra mouse clicks needed) and this contains an Undo link for those situations where Save was incorrectly clicked.
    – SteveD
    Commented Sep 28, 2016 at 12:01

The error prevention message will make sense if canceling all the changes has huge consequences. Consequences can be in form of lose of valuable time or miss happenings.

For example if they hit cancel they have to re-write the entire form once again from the beginning, considering it's a long form.

Or once hit cancel, the system takes a different course of action leading to loss of money, recourses, more complains, unsatisfied customers etc.


well there is something similar on here when you close a browser window "stay on page or leave" or some-such

However, in your case the user has already made their decision. If they wanted to save their work they would have clicked save. Sure they might click cancel by accident but this would be a minority of users. By having a confirm cancel step you create an extra click for everyone else.

Dont do it

  • What if there would be a validation if any changes have been made? So warning message will be only shown if it's true.
    – rpavl
    Commented Sep 29, 2016 at 11:12

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.