diff options
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/modal.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/js/src/modal.js b/js/src/modal.js index e2b711e5b..48ff5b854 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -306,9 +306,12 @@ class Modal { } _setEscapeEvent() { - if (this._isShown && this._config.keyboard) { + if (this._isShown) { EventHandler.on(this._element, Event.KEYDOWN_DISMISS, event => { - if (event.which === ESCAPE_KEYCODE) { + if (this._config.keyboard && event.which === ESCAPE_KEYCODE) { + event.preventDefault() + this.hide() + } else if (!this._config.keyboard && event.which === ESCAPE_KEYCODE) { this._triggerBackdropTransition() } }) |
