add comment to clarify fix

This commit is contained in:
Jeremy Kauffman 2017-08-28 13:56:55 -04:00
parent be6f93ac71
commit ed6c282572

View file

@ -69,7 +69,8 @@ export class DropDownMenu extends React.PureComponent {
}); });
} }
handleWindowClick = (e) => { /*this will force "this" to always be the class, even when passed to an event listener*/
handleWindowClick = e => {
if ( if (
this.state.menuOpen && this.state.menuOpen &&
(!this._menuDiv || !this._menuDiv.contains(e.target)) (!this._menuDiv || !this._menuDiv.contains(e.target))
@ -78,7 +79,7 @@ export class DropDownMenu extends React.PureComponent {
menuOpen: false, menuOpen: false,
}); });
} }
} };
render() { render() {
if (!this.state.menuOpen && this._isWindowClickBound) { if (!this.state.menuOpen && this._isWindowClickBound) {