From a397e0f60a33563fba669dad7f2a2c0f4f43558a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20G=C3=B3mez?= Date: Thu, 22 Jul 2021 14:46:41 +0200 Subject: [PATCH] [Logs UI] Prevent the "Alerts and rules" context menu from sticking (#106408) --- .../alerting/log_threshold/components/alert_dropdown.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/infra/public/alerting/log_threshold/components/alert_dropdown.tsx b/x-pack/plugins/infra/public/alerting/log_threshold/components/alert_dropdown.tsx index 302de15db9f5..ca291c49e49d 100644 --- a/x-pack/plugins/infra/public/alerting/log_threshold/components/alert_dropdown.tsx +++ b/x-pack/plugins/infra/public/alerting/log_threshold/components/alert_dropdown.tsx @@ -54,13 +54,18 @@ export const AlertDropdown = () => { setPopoverOpen(true); }, [setPopoverOpen]); + const openFlyout = useCallback(() => { + setFlyoutVisible(true); + closePopover(); + }, [setFlyoutVisible, closePopover]); + const menuItems = useMemo(() => { return [ setFlyoutVisible(true)} + onClick={openFlyout} toolTipContent={!canCreateAlerts ? readOnlyUserTooltipContent : undefined} toolTipTitle={!canCreateAlerts ? readOnlyUserTooltipTitle : undefined} > @@ -76,7 +81,7 @@ export const AlertDropdown = () => { /> , ]; - }, [manageAlertsLinkProps, canCreateAlerts]); + }, [manageAlertsLinkProps, canCreateAlerts, openFlyout]); return ( <>