Commit 19930ee3 by kay delaney Committed by GitHub

Dashboard: Panel menu no longer lingers (#26974)

Closes #26306
parent 5da3276d
......@@ -25,17 +25,17 @@ export class ClickOutsideWrapper extends PureComponent<Props, State> {
};
componentDidMount() {
window.addEventListener('click', this.onOutsideClick, false);
document.addEventListener('click', this.onOutsideClick, false);
if (this.props.includeButtonPress) {
// Use keyup since keydown already has an eventlistener on window
window.addEventListener('keyup', this.onOutsideClick, false);
document.addEventListener('keyup', this.onOutsideClick, false);
}
}
componentWillUnmount() {
window.removeEventListener('click', this.onOutsideClick, false);
document.removeEventListener('click', this.onOutsideClick, false);
if (this.props.includeButtonPress) {
window.removeEventListener('keyup', this.onOutsideClick, false);
document.removeEventListener('keyup', this.onOutsideClick, false);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment