mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-25 06:21:26 +02:00
Backport #30326
Prevent overflowing static backdrop modal animation TODO: backport the test too
This commit is contained in:
@@ -238,12 +238,25 @@ class Modal {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight
|
||||||
|
|
||||||
|
if (!isModalOverflowing) {
|
||||||
|
this._element.style.overflowY = 'hidden'
|
||||||
|
}
|
||||||
|
|
||||||
this._element.classList.add(CLASS_NAME_STATIC)
|
this._element.classList.add(CLASS_NAME_STATIC)
|
||||||
|
|
||||||
const modalTransitionDuration = Util.getTransitionDurationFromElement(this._element)
|
const modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog)
|
||||||
|
$(this._element).off(Util.TRANSITION_END)
|
||||||
|
|
||||||
$(this._element).one(Util.TRANSITION_END, () => {
|
$(this._element).one(Util.TRANSITION_END, () => {
|
||||||
this._element.classList.remove(CLASS_NAME_STATIC)
|
this._element.classList.remove(CLASS_NAME_STATIC)
|
||||||
|
if (!isModalOverflowing) {
|
||||||
|
$(this._element).one(Util.TRANSITION_END, () => {
|
||||||
|
this._element.style.overflowY = ''
|
||||||
|
})
|
||||||
|
.emulateTransitionEnd(this._element, modalTransitionDuration)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.emulateTransitionEnd(modalTransitionDuration)
|
.emulateTransitionEnd(modalTransitionDuration)
|
||||||
this._element.focus()
|
this._element.focus()
|
||||||
|
Reference in New Issue
Block a user