From 7753bd8931a0b3f8cd8b5e7bbd8286c604fa1977 Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Sat, 12 Aug 2017 14:55:34 +0800 Subject: [PATCH] Popup: fix missing padding-right when overflow-y is scroll --- src/utils/popup/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/popup/index.js b/src/utils/popup/index.js index daa562d3d..13b6b4925 100644 --- a/src/utils/popup/index.js +++ b/src/utils/popup/index.js @@ -2,6 +2,7 @@ import Vue from 'vue'; import merge from 'element-ui/src/utils/merge'; import PopupManager from 'element-ui/src/utils/popup/popup-manager'; import getScrollBarWidth from '../scrollbar-width'; +import { getStyle } from '../dom'; let idSeed = 1; const transitions = []; @@ -198,7 +199,8 @@ export default { } scrollBarWidth = getScrollBarWidth(); let bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight; - if (scrollBarWidth > 0 && bodyHasOverflow) { + let bodyOverflowY = getStyle(document.body, 'overflowY'); + if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll')) { document.body.style.paddingRight = scrollBarWidth + 'px'; } document.body.style.overflow = 'hidden';