]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Respect modal's initial overflowY
authorGeoSot <geo.sotis@gmail.com>
Fri, 8 Oct 2021 00:19:18 +0000 (03:19 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Thu, 25 Nov 2021 17:23:49 +0000 (19:23 +0200)
js/src/modal.js

index c96ad388cc5e456247e47b87d5c479757326deab..ecbf5cadca70e17c0da20f27aedb5ab4883cb522 100644 (file)
@@ -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()