1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-07 22:26:57 +02:00

Fix prevented show event disables modals with fade class from being displayed again (#34085)

Fix modal, in case is faded, a prevented show event can cause show method to not  be executed again.
This commit is contained in:
alpadev
2021-05-24 17:52:36 +02:00
committed by GitHub
parent 136665903b
commit b513a19003
2 changed files with 35 additions and 6 deletions

View File

@@ -108,20 +108,20 @@ class Modal extends BaseComponent {
return
}
if (this._isAnimated()) {
this._isTransitioning = true
}
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
relatedTarget
})
if (this._isShown || showEvent.defaultPrevented) {
if (showEvent.defaultPrevented) {
return
}
this._isShown = true
if (this._isAnimated()) {
this._isTransitioning = true
}
scrollBarHide()
document.body.classList.add(CLASS_NAME_OPEN)