From: GeoSot Date: Fri, 8 Oct 2021 00:19:18 +0000 (+0300) Subject: Respect modal's initial overflowY X-Git-Tag: v5.2.0-beta1~421 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f9fd75d6c7bfd850f50d6a587c54b8e1227830c;p=thirdparty%2Fbootstrap.git Respect modal's initial overflowY --- diff --git a/js/src/modal.js b/js/src/modal.js index c96ad388cc..ecbf5cadca 100644 --- a/js/src/modal.js +++ b/js/src/modal.js @@ -296,9 +296,9 @@ class Modal extends BaseComponent { const { classList, scrollHeight, style } = this._element const isModalOverflowing = scrollHeight > document.documentElement.clientHeight - + const initialOverflowY = style.overflowY // 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 } @@ -309,11 +309,9 @@ class Modal extends BaseComponent { classList.add(CLASS_NAME_STATIC) this._queueCallback(() => { classList.remove(CLASS_NAME_STATIC) - if (!isModalOverflowing) { - this._queueCallback(() => { - style.overflowY = '' - }, this._dialog) - } + this._queueCallback(() => { + style.overflowY = initialOverflowY + }, this._dialog) }, this._dialog) this._element.focus()