Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 7ed0af6

Browse files
committed
fix(mdUtil): fix double scrollbar
closes #3382
1 parent 5cc9af4 commit 7ed0af6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/core/util/util.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ angular.module('material.core')
105105
// Converts the body to a position fixed block and translate it to the proper scroll
106106
// position
107107
function disableBodyScroll() {
108-
var restoreStyle = body.getAttribute('style') || '';
108+
var htmlNode = body.parentNode;
109+
var restoreHtmlStyle = htmlNode.getAttribute('style') || '';
110+
var restoreBodyStyle = body.getAttribute('style') || '';
109111
var scrollOffset = body.scrollTop + body.parentElement.scrollTop;
110112
var clientWidth = body.clientWidth;
111113

@@ -116,10 +118,15 @@ angular.module('material.core')
116118
top: -scrollOffset + 'px'
117119
});
118120

121+
applyStyles(htmlNode, {
122+
overflowY: 'hidden'
123+
});
124+
119125
if (body.clientWidth < clientWidth) applyStyles(body, {overflow: 'hidden'});
120126

121127
return function restoreScroll() {
122-
body.setAttribute('style', restoreStyle);
128+
body.setAttribute('style', restoreBodyStyle);
129+
htmlNode.setAttribute('style', restoreHtmlStyle);
123130
body.scrollTop = scrollOffset;
124131
};
125132
}

0 commit comments

Comments
 (0)