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

Commit 7fe482c

Browse files
committed
fix(disableScroll): fix disable scroll creating scrollbar when none existed
1 parent 05119a7 commit 7fe482c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/core/util/util.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,14 @@ angular.module('material.core')
113113
var scrollOffset = body.scrollTop + body.parentElement.scrollTop;
114114
var clientWidth = body.clientWidth;
115115

116-
applyStyles(body, {
117-
position: 'fixed',
118-
width: '100%',
119-
overflowY: 'scroll',
120-
top: -scrollOffset + 'px'
121-
});
116+
if (body.scrollHeight > body.clientHeight) {
117+
applyStyles(body, {
118+
position: 'fixed',
119+
width: '100%',
120+
overflowY: 'scroll',
121+
top: -scrollOffset + 'px'
122+
});
123+
}
122124

123125
applyStyles(htmlNode, {
124126
overflowY: 'hidden'

0 commit comments

Comments
 (0)