diff options
author | Giovanni Mendoza <mendozagioo@gmail.com> | 2020-01-10 12:06:12 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2020-02-17 22:33:54 +0300 |
commit | 6daae47cc08342a7302b32f29654ac281298f498 (patch) | |
tree | 4d155eb0cc402d17f311b55e3d58eb388cac02cf /js/src/modal.js | |
parent | 0f0a8c364d8d3dbd2d18ab27f9c6e3199e811bfc (diff) |
Backport #29886
Close modal with keyboard=true & backdrop=static
Diffstat (limited to 'js/src/modal.js')
-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 ad925f6ff4..faaa8f1083 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -325,9 +325,12 @@ class Modal { } _setEscapeEvent() { - if (this._isShown && this._config.keyboard) { + if (this._isShown) { $(this._element).on(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() } }) |