2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-05 16:42:29 +03:00
Close modal with keyboard=true & backdrop=static
This commit is contained in:
Giovanni Mendoza
2020-01-10 11:06:12 +02:00
committed by XhmikosR
parent 0f0a8c364d
commit 6daae47cc0
3 changed files with 58 additions and 6 deletions
+5 -2
View File
@@ -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()
}
})