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

Commit 5c08d5c

Browse files
author
Robert Messerle
committed
fix(menu): prevents scrollbar from unnecessarily showing up on the body
Closes #3266
1 parent 43c273e commit 5c08d5c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/core/util/util.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ angular.module('material.core')
107107
function disableBodyScroll() {
108108
var restoreStyle = body.getAttribute('style') || '';
109109
var scrollOffset = body.scrollTop + body.parentElement.scrollTop;
110+
var clientWidth = body.clientWidth;
110111

111112
applyStyles(body, {
112113
position: 'fixed',
@@ -115,6 +116,8 @@ angular.module('material.core')
115116
top: -scrollOffset + 'px'
116117
});
117118

119+
if (body.clientWidth < clientWidth) applyStyles(body, { overflow: 'auto' });
120+
118121
return function restoreScroll() {
119122
body.setAttribute('style', restoreStyle);
120123
body.scrollTop = scrollOffset;

0 commit comments

Comments
 (0)