mirror of https://github.com/twbs/bootstrap.git
Respect modal's initial overflowY
This commit is contained in:
parent
cc3e5789ec
commit
0f9fd75d6c
|
@ -296,9 +296,9 @@ class Modal extends BaseComponent {
|
||||||
|
|
||||||
const { classList, scrollHeight, style } = this._element
|
const { classList, scrollHeight, style } = this._element
|
||||||
const isModalOverflowing = scrollHeight > document.documentElement.clientHeight
|
const isModalOverflowing = scrollHeight > document.documentElement.clientHeight
|
||||||
|
const initialOverflowY = style.overflowY
|
||||||
// return if the following background transition hasn't yet completed
|
// return if the following background transition hasn't yet completed
|
||||||
if ((!isModalOverflowing && style.overflowY === 'hidden') || classList.contains(CLASS_NAME_STATIC)) {
|
if (initialOverflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,11 +309,9 @@ class Modal extends BaseComponent {
|
||||||
classList.add(CLASS_NAME_STATIC)
|
classList.add(CLASS_NAME_STATIC)
|
||||||
this._queueCallback(() => {
|
this._queueCallback(() => {
|
||||||
classList.remove(CLASS_NAME_STATIC)
|
classList.remove(CLASS_NAME_STATIC)
|
||||||
if (!isModalOverflowing) {
|
this._queueCallback(() => {
|
||||||
this._queueCallback(() => {
|
style.overflowY = initialOverflowY
|
||||||
style.overflowY = ''
|
}, this._dialog)
|
||||||
}, this._dialog)
|
|
||||||
}
|
|
||||||
}, this._dialog)
|
}, this._dialog)
|
||||||
|
|
||||||
this._element.focus()
|
this._element.focus()
|
||||||
|
|
Loading…
Reference in New Issue