Skip to content

Commit 46e98b3

Browse files
committed
Use document instead of window for SSR
1 parent a54729e commit 46e98b3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/material-ui/src/Popper/Popper.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import ownerWindow from '../utils/ownerWindow';
1313
* @param {string} placement
1414
*/
1515
function flipPlacement(placement) {
16-
const direction = (typeof window !== 'undefined' && document.body.getAttribute('dir')) || 'ltr';
16+
const direction = (typeof document !== 'undefined' && document.body.getAttribute('dir')) || 'ltr';
1717

1818
if (direction !== 'rtl') {
1919
return placement;
@@ -126,11 +126,11 @@ const Popper = React.forwardRef(function Popper(props, ref) {
126126
...(disablePortal
127127
? {}
128128
: {
129-
// It's using scrollParent by default, we can use the viewport when using a portal.
130-
preventOverflow: {
131-
boundariesElement: 'window',
132-
},
133-
}),
129+
// It's using scrollParent by default, we can use the viewport when using a portal.
130+
preventOverflow: {
131+
boundariesElement: 'window',
132+
},
133+
}),
134134
...modifiers,
135135
...popperOptions.modifiers,
136136
},

0 commit comments

Comments
 (0)