Skip to content

Commit

Permalink
[Popper] Use placement viewport instead of window (#22748)
Browse files Browse the repository at this point in the history
  • Loading branch information
maksimgm authored Sep 28, 2020
1 parent e24cb57 commit 8ea6bbf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/material-ui/src/Popper/Popper.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const Popper = React.forwardRef(function Popper(props, ref) {
: {
// It's using scrollParent by default, we can use the viewport when using a portal.
preventOverflow: {
boundariesElement: 'window',
boundariesElement: 'viewport',
},
}),
...modifiers,
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/Popper/Popper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,14 @@ describe('<Popper />', () => {
);
});

it('sets preventOverflow to window when disablePortal is false', () => {
it('sets preventOverflow to viewport when disablePortal is false', () => {
const popperRef = React.createRef();
const { getByRole } = render(<Popper {...defaultProps} popperRef={popperRef} />);
// renders
expect(getByRole('tooltip')).to.not.equal(null);
// correctly sets modifiers
expect(popperRef.current.options.modifiers.preventOverflow.boundariesElement).to.equal(
'window',
'viewport',
);
});
});
Expand Down

0 comments on commit 8ea6bbf

Please sign in to comment.