Skip to content

Commit

Permalink
fix(modal): respect approve deny callback on js modals
Browse files Browse the repository at this point in the history
When using modals via JS properties only having any approve/deny buttons declared as actions, those did not respect the onApprove or onDeny callbacks returning a possible false to prevent hiding the modal.
  • Loading branch information
lubber-de committed Sep 17, 2021
1 parent e8e7ca4 commit 8672140
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/definitions/modules/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ $.fn.modal = function(parameters) {
'aria-label': $('<div>'+(el[fields.text] || el[fields.icon] || '')+'</div>').text(),
class: className.button + ' ' + cls,
click: function () {
if (click.call(element, $module) === false) {
var button = $(this);
if (button.is(selector.approve) || button.is(selector.deny) || click.call(element, $module) === false) {
return;
}
module.hide();
Expand Down Expand Up @@ -772,7 +773,7 @@ $.fn.modal = function(parameters) {
$module
.off('mousedown' + elementEventNamespace)
;
}
}
$dimmer
.off('mousedown' + elementEventNamespace)
;
Expand Down Expand Up @@ -1042,7 +1043,7 @@ $.fn.modal = function(parameters) {
? $(document).scrollTop() + settings.padding
: $(document).scrollTop() + (module.cache.contextHeight - module.cache.height - settings.padding),
marginLeft: -(module.cache.width / 2)
})
})
;
} else {
$module
Expand All @@ -1051,7 +1052,7 @@ $.fn.modal = function(parameters) {
? -(module.cache.height / 2)
: settings.padding / 2,
marginLeft: -(module.cache.width / 2)
})
})
;
}
module.verbose('Setting modal offset for legacy mode');
Expand Down

0 comments on commit 8672140

Please sign in to comment.