Skip to content

Commit

Permalink
[Popover/Modal] Prevent page scroll on open when html overflow is not…
Browse files Browse the repository at this point in the history
… applied
  • Loading branch information
Andreas Heim committed Nov 19, 2019
1 parent 9c2f734 commit ddedc56
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/material-ui/src/Modal/ModalManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ function handleContainer(containerInfo, props) {
// Improve Gatsby support
// https://css-tricks.com/snippets/css/force-vertical-scrollbar/
const parent = container.parentElement;
const scrollContainer = parent.nodeName === 'HTML' ? parent : container;
const scrollContainer =
parent.nodeName === 'HTML' && window.getComputedStyle(parent)['overflow-y'] === 'scroll'
? parent
: container;

restoreStyle.push({
value: scrollContainer.style.overflow,
Expand Down

0 comments on commit ddedc56

Please sign in to comment.