mirror of
https://github.com/grafana/grafana.git
synced 2025-01-26 16:27:02 -06:00
Popover menu: remove selectionchange listener (#84832)
This commit is contained in:
parent
821d9a5565
commit
7e8e7429ec
@ -134,7 +134,6 @@ class UnThemedLogRows extends PureComponent<Props, State> {
|
||||
});
|
||||
document.addEventListener('click', this.handleDeselection);
|
||||
document.addEventListener('contextmenu', this.handleDeselection);
|
||||
document.addEventListener('selectionchange', this.handleDeselection);
|
||||
return true;
|
||||
};
|
||||
|
||||
@ -147,17 +146,11 @@ class UnThemedLogRows extends PureComponent<Props, State> {
|
||||
if (document.getSelection()?.toString()) {
|
||||
return;
|
||||
}
|
||||
// Give time to the browser to process click events originating from the menu before closing it.
|
||||
// Otherwise selectionchange fires before other click listeners, potentially skipping user actions.
|
||||
setTimeout(() => {
|
||||
this.closePopoverMenu();
|
||||
}, 100);
|
||||
};
|
||||
|
||||
closePopoverMenu = () => {
|
||||
document.removeEventListener('click', this.handleDeselection);
|
||||
document.removeEventListener('contextmenu', this.handleDeselection);
|
||||
document.removeEventListener('selectionchange', this.handleDeselection);
|
||||
this.setState({
|
||||
selection: '',
|
||||
popoverMenuCoordinates: { x: 0, y: 0 },
|
||||
|
Loading…
Reference in New Issue
Block a user