diff --git a/src/core/util/util.js b/src/core/util/util.js index bc28d14d898..66bacd8e545 100644 --- a/src/core/util/util.js +++ b/src/core/util/util.js @@ -107,6 +107,7 @@ angular.module('material.core') function disableBodyScroll() { var restoreStyle = body.getAttribute('style') || ''; var scrollOffset = body.scrollTop + body.parentElement.scrollTop; + var clientWidth = body.clientWidth; applyStyles(body, { position: 'fixed', @@ -115,6 +116,8 @@ angular.module('material.core') top: -scrollOffset + 'px' }); + if (body.clientWidth < clientWidth) applyStyles(body, { overflow: 'auto' }); + return function restoreScroll() { body.setAttribute('style', restoreStyle); body.scrollTop = scrollOffset;