-
Notifications
You must be signed in to change notification settings - Fork 660
Open
Description
Recently I was selecting some text on a modal and ended up with the mouse cursor outside the modal. To my surprise, this closed the modal! You can test this behavior on the first example on the jQuery modal website:
In my eyes this is an undesired behavior, and it could be easily fixed by changing the following code (line 100 on jquery.modal.js):
if (this.options.clickClose)
this.$blocker.click(function(e) {
if (e.target === this)
$.modal.close();
});
with something like this:
if (this.options.clickClose) {
if (!this.$blocker.properties) {
this.$blocker.properties = {};
}
this.$blocker.properties.mousedown = false;
this.$blocker.off('mousedown').on('mousedown', function (e) {
if (e.target === this){
m.$blocker.properties.mousedown = true;
}
});
this.$blocker.off('mouseup').on('mouseup', function (e) {
if (e.target === this && m.$blocker.properties.mousedown) {
$.modal.close();
} else {
m.$blocker.properties.mousedown = false;
}
});
}
My code isn't very elegant but does the trick.
naramwork and danwakefield
Metadata
Metadata
Assignees
Labels
No labels