Skip to content

Commit

Permalink
Add null check for portalNode in handleOutsideMouseClick - PortalWith…
Browse files Browse the repository at this point in the history
…State
  • Loading branch information
odelijairo committed Jan 24, 2020
1 parent 7847bd5 commit 579bcaa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PortalWithState.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class PortalWithState extends React.Component {
if (!this.state.active) {
return;
}
const root = this.portalNode.props.node || this.portalNode.defaultNode;
const root = this.portalNode && (this.portalNode.props.node || this.portalNode.defaultNode);
if (!root || root.contains(e.target) || (e.button && e.button !== 0)) {
return;
}
Expand Down

0 comments on commit 579bcaa

Please sign in to comment.