Browse Source

Fixes #4479 - Approve/deny callbacks can occur multiple times if clicked quickly

pull/5122/merge
Jack Lukic 7 years ago
parent
commit
91dfe87b0f
2 changed files with 13 additions and 4 deletions
  1. 1
      RELEASE-NOTES.md
  2. 16
      src/definitions/modules/modal.js

1
RELEASE-NOTES.md

@ -10,6 +10,7 @@
- **Button** - Fixes `@basicActiveBoxShadow` being used incorrectly in basic button variables
- **Visibility** - Fixes issue where visibility events would occur improperly when using a `context` that have `overflow-x` or `overflow-y` set to `auto`
- **Dropdown** - Fixes an issue where dropdown would not correctly open `upward` at bottom edge of the screen when using a `context` with `overflow-x` or `overflow-y` set to `auto`
- **Modal** - `onDeny` and `onApprove` callbacks can no longer occur multiple times if you rapidly click a approve/deny button in a modal. #4479
### Version 2.2.10 - February 21, 2017

16
src/definitions/modules/modal.js

@ -72,6 +72,8 @@ $.fn.modal = function(parameters) {
element = this,
instance = $module.data(moduleNamespace),
ignoreRepeatedEvents = false,
elementEventNamespace,
id,
observer,
@ -226,18 +228,24 @@ $.fn.modal = function(parameters) {
event: {
approve: function() {
if(settings.onApprove.call(element, $(this)) === false) {
if(ignoreRepeatedEvents || settings.onApprove.call(element, $(this)) === false) {
module.verbose('Approve callback returned false cancelling hide');
return;
}
module.hide();
ignoreRepeatedEvents = true;
module.hide(function() {
ignoreRepeatedEvents = false;
});
},
deny: function() {
if(settings.onDeny.call(element, $(this)) === false) {
if(ignoreRepeatedEvents || settings.onDeny.call(element, $(this)) === false) {
module.verbose('Deny callback returned false cancelling hide');
return;
}
module.hide();
ignoreRepeatedEvents = true;
module.hide(function() {
ignoreRepeatedEvents = false;
});
},
close: function() {
module.hide();

Loading…
Cancel
Save