Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Popper] Use placement viewport instead of window #22748

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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