This is just an example, I'm sure you'll have your own situations. When using bootstrap-style dialogs and modal-dialogs, we often want to offer a "hit-escape" or "click on the background" to get away. Of course we must first check if the model is dirty(nothing changed) - to not loose data.
Now in our experience, people would often click on the background by accident. For example, they would be marking text with a mouse and releasing the button on the background. Or they would open a drop-down and not-select something by clicking beside the drop-down. In these cases a JavaScript dialog blocking the UI is very annoying, because it interrupts the use-flow.
The image to the side shows the alert as it used to be in the 2sxc-edit dialog before we refactored it.