I have been looking around at different modal dialogs, and wondered about the best way to let the user close it. Clearly, the X has become a standard user expectation to close the window. Clearly the Esc key should do that as well. But I notice some allow the user to click the background to dismiss the dialog, and some don't.
I believe that there are two different types of modals: things that require user input and those that don't. One type of dialog is informative and passive - like browsing a picture or "hey this happened". Another dialog type is a transaction, that the user has input on. For example clicking on a database record and the modal allows editing of fields on that record.
It would be very frustrating to have the user enter important information, and accidentally click outside the dialog closing the record and losing their changes. I can see how explicitly clicking on the X or Cancel button communicates the user's desire to exit the modal and lose his work. In real life, people have multiple windows open, and copy stuff from window to window.
In the passive case, it's no big deal to make it a little easier to close the dialog because there are no consequences.
Clearly all dialogs within an app should behave the same. An app might combine informative dialogs and transactional dialogs.
What do you think is the best practice for this in a webapp that has many transactional dialogs to edit important records? Thanks for your thoughts.