mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
UI/ClickOutsideWrapper: Fix for undesirable timepicker behavior (#27164)
This commit is contained in:
parent
1778e9f034
commit
b54c0b5d52
@ -25,17 +25,16 @@ export class ClickOutsideWrapper extends PureComponent<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.addEventListener('click', this.onOutsideClick, false);
|
document.addEventListener('mousedown', this.onOutsideClick, false);
|
||||||
if (this.props.includeButtonPress) {
|
if (this.props.includeButtonPress) {
|
||||||
// Use keyup since keydown already has an eventlistener on window
|
document.addEventListener('keydown', this.onOutsideClick, false);
|
||||||
document.addEventListener('keyup', this.onOutsideClick, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
document.removeEventListener('click', this.onOutsideClick, false);
|
document.removeEventListener('mousedown', this.onOutsideClick, false);
|
||||||
if (this.props.includeButtonPress) {
|
if (this.props.includeButtonPress) {
|
||||||
document.removeEventListener('keyup', this.onOutsideClick, false);
|
document.removeEventListener('keydown', this.onOutsideClick, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user