Skip to content

Commit 78d51f1

Browse files
authored
fix(b-modal): solve body padding not being removed (#5771)
* update dom.js * update * update modal-manager.js
1 parent 2a5a56e commit 78d51f1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/modal/helpers/modal-manager.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -159,29 +159,29 @@ const ModalManager = /*#__PURE__*/ Vue.extend({
159159
// Adjust fixed content padding
160160
/* istanbul ignore next: difficult to test in JSDOM */
161161
selectAll(Selector.FIXED_CONTENT).forEach(el => {
162-
const actualPadding = getStyle(el, 'paddingRight')
162+
const actualPadding = getStyle(el, 'paddingRight') || ''
163163
setAttr(el, 'data-padding-right', actualPadding)
164164
setStyle(el, 'paddingRight', `${toFloat(getCS(el).paddingRight, 0) + scrollbarWidth}px`)
165165
body._paddingChangedForModal.push(el)
166166
})
167167
// Adjust sticky content margin
168168
/* istanbul ignore next: difficult to test in JSDOM */
169169
selectAll(Selector.STICKY_CONTENT).forEach(el => /* istanbul ignore next */ {
170-
const actualMargin = getStyle(el, 'marginRight')
170+
const actualMargin = getStyle(el, 'marginRight') || ''
171171
setAttr(el, 'data-margin-right', actualMargin)
172172
setStyle(el, 'marginRight', `${toFloat(getCS(el).marginRight, 0) - scrollbarWidth}px`)
173173
body._marginChangedForModal.push(el)
174174
})
175175
// Adjust <b-navbar-toggler> margin
176176
/* istanbul ignore next: difficult to test in JSDOM */
177177
selectAll(Selector.NAVBAR_TOGGLER).forEach(el => /* istanbul ignore next */ {
178-
const actualMargin = getStyle(el, 'marginRight')
178+
const actualMargin = getStyle(el, 'marginRight') || ''
179179
setAttr(el, 'data-margin-right', actualMargin)
180180
setStyle(el, 'marginRight', `${toFloat(getCS(el).marginRight, 0) + scrollbarWidth}px`)
181181
body._marginChangedForModal.push(el)
182182
})
183183
// Adjust body padding
184-
const actualPadding = getStyle(body, 'paddingRight')
184+
const actualPadding = getStyle(body, 'paddingRight') || ''
185185
setAttr(body, 'data-padding-right', actualPadding)
186186
setStyle(body, 'paddingRight', `${toFloat(getCS(body).paddingRight, 0) + scrollbarWidth}px`)
187187
}

0 commit comments

Comments
 (0)