diff --git a/src/modal/modal.js b/src/modal/modal.js index 356299da8b..ac4bb3b272 100644 --- a/src/modal/modal.js +++ b/src/modal/modal.js @@ -158,7 +158,14 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p }; // 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 1e43b037d2..6d0cebb656 100644 --- a/src/modal/test/modal.spec.js +++ b/src/modal/test/modal.spec.js @@ -427,7 +427,10 @@ describe('$uibModal', function() { var modal = open({template: '