Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Fixed #5806: Modal dialog closes when mouse button is pressed over th… #5807

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,18 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
}
};

// moved from template to fix issue #2280
element.on('click', scope.close);
var pointerDownElement;
element.on('mousedown', function (event) {
pointerDownElement = event.target;
});

element.on('mouseup', function (event) {
var element = event.target;

if (element === pointerDownElement) {
scope.close(event);
}
});

// 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
Expand Down