diff --git a/src/modal/modal.js b/src/modal/modal.js index 679ff188e8..b0035541e2 100644 --- a/src/modal/modal.js +++ b/src/modal/modal.js @@ -101,7 +101,13 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.multiMap', 'ui.bootstrap.sta }; // moved from template to fix issue #2280 - element.on('click', scope.close); + element.on('mousedown', function(evt1) { + element.one('mouseup', function(evt2) { + if (evt1.target === evt2.target) { + scope.close.apply(this, arguments); + } + }); + }); // This property is only added to the scope for the purpose of detecting when this directive is rendered. // We can detect that by using this property in the template associated with this directive and then use diff --git a/src/modal/test/modal.spec.js b/src/modal/test/modal.spec.js index 4bf85243da..5bc55bb85b 100644 --- a/src/modal/test/modal.spec.js +++ b/src/modal/test/modal.spec.js @@ -508,9 +508,12 @@ describe('$uibModal', function() { it('should support closing on backdrop click', function() { var modal = open({template: '