aboutsummaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorMuhammadamin <[email protected]>2021-02-23 07:52:09 -0500
committerGitHub <[email protected]>2021-02-23 14:52:09 +0200
commit056216a3bd2fd1f28ba9ec6f2797aa2aaec5c6f0 (patch)
tree1a1b76999378836e36ccdc4a4a8bb549213b303c /js/src
parent45ff785377bfc3e96889ee1c3d30364ba06a177a (diff)
downloadbootstrap-056216a3bd2fd1f28ba9ec6f2797aa2aaec5c6f0.tar.xz
bootstrap-056216a3bd2fd1f28ba9ec6f2797aa2aaec5c6f0.zip
modal: don't add margin & padding when sticky is not full width (#30621)
* modal: don't add margin & padding when sticky is not full width * Check if element is shorter than window Co-authored-by: XhmikosR <[email protected]> Co-authored-by: Rohit Sharma <[email protected]>
Diffstat (limited to 'js/src')
-rw-r--r--js/src/modal.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/js/src/modal.js b/js/src/modal.js
index 4f42e733e..5afb9791b 100644
--- a/js/src/modal.js
+++ b/js/src/modal.js
@@ -466,6 +466,10 @@ class Modal extends BaseComponent {
_setElementAttributes(selector, styleProp, callback) {
SelectorEngine.find(selector)
.forEach(element => {
+ if (element !== document.body && window.innerWidth > element.clientWidth + this._scrollbarWidth) {
+ return
+ }
+
const actualValue = element.style[styleProp]
const calculatedValue = window.getComputedStyle(element)[styleProp]
Manipulator.setDataAttribute(element, styleProp, actualValue)