fix refreshPosition

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2021-04-26 16:27:44 -04:00
1 parent 650b24c1f0
commit 931259b731
1 file changed
+4 -1
+4 -1
View File
@@ -122,7 +122,10 @@ export class Menu extends React.Component<MenuProps, State> {
} }
refreshPosition = () => { refreshPosition = () => {
if (!this.props.usePortal || !this.opener) return; if (!this.props.usePortal || !this.opener || !this.elem) {
return;
}
const { width, height } = this.opener.getBoundingClientRect(); const { width, height } = this.opener.getBoundingClientRect();
let { left, top, bottom, right } = this.opener.getBoundingClientRect(); let { left, top, bottom, right } = this.opener.getBoundingClientRect();
const withScroll = window.getComputedStyle(this.elem).position !== "fixed"; const withScroll = window.getComputedStyle(this.elem).position !== "fixed";