diff options
| author | Giovanni Mendoza <[email protected]> | 2020-01-10 11:06:12 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2020-02-17 21:33:54 +0200 |
| commit | 6daae47cc08342a7302b32f29654ac281298f498 (patch) | |
| tree | 4d155eb0cc402d17f311b55e3d58eb388cac02cf /js/src | |
| parent | 0f0a8c364d8d3dbd2d18ab27f9c6e3199e811bfc (diff) | |
| download | bootstrap-6daae47cc08342a7302b32f29654ac281298f498.tar.xz bootstrap-6daae47cc08342a7302b32f29654ac281298f498.zip | |
Backport #29886
Close modal with keyboard=true & backdrop=static
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 ad925f6ff..faaa8f108 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() } }) |
