diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 7f553c9fc..3e4a2c76e 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -5,6 +5,7 @@ **Enhancements** - **Form Validation** - Bracketed notation can now be omitted for rules, instead passing in bracketed values with the `value` parameter #3313 - **Dropdown** - Using `search selection` with `selectOnKeydown` will now highlight the partial search matching the currently keyboard selected value +- **Modal** - Modal now includes setting to enable/disable keyboard shortcuts **Bugs** - **NPM** - Fixed `package.json` to allow either jQuery `2.x` or `3.x` #4254 diff --git a/src/definitions/modules/modal.js b/src/definitions/modules/modal.js index 07b0409eb..5a9f7d03c 100644 --- a/src/definitions/modules/modal.js +++ b/src/definitions/modules/modal.js @@ -345,7 +345,9 @@ $.fn.modal = function(parameters) { useFailSafe : true, onComplete : function() { settings.onVisible.apply(element); - module.add.keyboardShortcuts(); + if(settings.keyboardShortcuts) { + module.add.keyboardShortcuts(); + } module.save.focus(); module.set.active(); if(settings.autofocus) { @@ -391,7 +393,9 @@ $.fn.modal = function(parameters) { if(!module.others.active() && !keepDimmed) { module.hideDimmer(); } - module.remove.keyboardShortcuts(); + if(settings.keyboardShortcuts) { + module.remove.keyboardShortcuts(); + } }, onComplete : function() { settings.onHidden.call(element); @@ -854,6 +858,8 @@ $.fn.modal.settings = { useCSS : true }, + // whether to use keyboard shortcuts + keyboardShortcuts: true, context : 'body',