mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-26 06:44:35 +02:00
Close modal with keyboard=true & backdrop=static (#29986)
* Close modal with keyboard=true & backdrop=static
This commit is contained in:
committed by
XhmikosR
parent
4e1fb4fe1a
commit
954a0b1e6a
@@ -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()
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user