• OnOK
  • OnClose

But, what about OnCancel? If the user cancels the dialog what is the standard? Should it still remember the window position? Is there guidance on this?

If this question is going to invoke personal opinions then I will close it. I am specifically interested in knowing if there is a guideline on this matter. At the moment I am not saving window positions when cancel is pressed.

  • You can redirect OnClose to OnCancel, since they usually mean the same thing.
    – Barmak Shemirani
    Jun 20, 2018 at 18:55
  • @BarmakShemirani Yes, perhaps. I kind of think OnClose should save but not OnCancel. Jun 20, 2018 at 19:02
  • 3
    Windows OpenSave dialog box sort of works the same, it always remembers the position. It's up to you really.
    – Barmak Shemirani
    Jun 20, 2018 at 19:03

2 Answers 2



Yes, if you save position on OK and Close, you should save position on Cancel, because Cancel is about cancelling the action, not cancelling where the user placed their window to be most useful for them.

Michael Medlock (Research @ Microsoft, then Facebook) and Steve Herbst (Head of UX @ Amazon) researched multiple UX books and guidance for years.

They came up with a terminology deck related to common UX traps. The trap you are describing is called Variable Outcome under the Habituating tenet under their framework.

"Variable Outcome" means "the system responds differently at different times to the same user action."

They sell their cards on https://uitraps.com. I'm not affiliated and don't benefit from sharing the link, although I'm a big fan.


Cancel should never save state, since the idea of cancellation is to undo whatever was done in the task in the window.

In the Tenet & Traps framework keeping state on Cancel falls under these traps:

  • "Irreversible Action" because there's no way to easily cancel out of some edits to state.

  • "Memory Challenge" because the system expects the customer to remember what's the default state.


State and position are different things.

Saving the position is easier: - After moving (including moving to the initial position) - After resizing (including setting the initial size)

Saving the state is more complex. It depends on the purpose of the dialog (edit some data, like edit preferences dialog; selection actions like file selection dialog) and your your confirmation paradigm (asking for confirmation or not).

1A) Edit data or preferences with confirmations. Save the state only on the actions that explicitly or implicitly mean confirmation like OK, Save, Continue. Don't save on Cancel, Exit, Close an similar actions.

1B) Edit data or preferences without confirmations. Save state on any action. If some user want to restore the previous state, provide Reset button.

2) Selection actions (like select file to open, select font type). Save state when use has completed selection. Don't save otherwise.

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.