aboutsummaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorGiovanni Mendoza <[email protected]>2020-01-10 11:06:12 +0200
committerXhmikosR <[email protected]>2020-02-17 21:33:54 +0200
commit6daae47cc08342a7302b32f29654ac281298f498 (patch)
tree4d155eb0cc402d17f311b55e3d58eb388cac02cf /js/src
parent0f0a8c364d8d3dbd2d18ab27f9c6e3199e811bfc (diff)
downloadbootstrap-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.js7
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()
}
})