From 7e8e7429ecce428466adab6fc6aa099ca78142aa Mon Sep 17 00:00:00 2001 From: Matias Chomicki Date: Wed, 20 Mar 2024 16:48:33 +0100 Subject: [PATCH] Popover menu: remove selectionchange listener (#84832) --- public/app/features/logs/components/LogRows.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/public/app/features/logs/components/LogRows.tsx b/public/app/features/logs/components/LogRows.tsx index 03110895b35..3049d5ba9d7 100644 --- a/public/app/features/logs/components/LogRows.tsx +++ b/public/app/features/logs/components/LogRows.tsx @@ -134,7 +134,6 @@ class UnThemedLogRows extends PureComponent { }); 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 { 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 },