powmedia / backbone.bootstrap-modal

Bootstrap Modal wrapper for use with Backbone.
MIT License
183 stars 97 forks source link

on Hide/Hidden event missing when clicked outside the modal #75

Open maxchirkov opened 9 years ago

maxchirkov commented 9 years ago

When allowCancel === true - modal can be closed by clicking outside of its boundaries. The View as far as I can tell doesn't react to this event via hidden.

After testing: cancel, close, ok and click outside - I determined that all actions trigger hidden.bs.modal. First 3 events also trigger hidden in the BootstrapModal, but not the click outside of the modal.

I had to implement a workaround and instead of using this.bind('hidden', callback), I'm using:

$(document).on('hidden.bs.modal', '.modal', {view: this}, callback);

It would be nice if hidden event would cover the click outside of modal boundaries as well.

benlind commented 8 years ago

I have also noticed this behavior. Since I don't want to have to listen on the hidden.bs.modal event through the document, I have opted to just pass backdrop: 'static' to modalOptions. It would be great if you could provide a permanent fix.