This is to prevent the bubbled-up clicks from triggering changes behind the modal overlay (e.g., the auto-closing of open dropdowns).
var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init'),
bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0];
- if (bg_clicked && !settings.close_on_background_click) {
- return;
+ if (bg_clicked) {
+ if (settings.close_on_background_click) {
+ e.stopPropagation();
+ } else {
+ return;
+ }
}
self.locked = true;