From c67bc3e080e77df0681c6e59c6150c4546bf50dd Mon Sep 17 00:00:00 2001 From: ayeshoali Date: Thu, 26 Jan 2023 15:44:10 +0500 Subject: [PATCH] fix: fixed blur event for actions dropdown --- src/discussions/common/HoverCard.jsx | 7 +++---- src/discussions/posts/post/Post.jsx | 10 +++++++--- src/index.scss | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/discussions/common/HoverCard.jsx b/src/discussions/common/HoverCard.jsx index b06f4911..bea86d6c 100644 --- a/src/discussions/common/HoverCard.jsx +++ b/src/discussions/common/HoverCard.jsx @@ -33,11 +33,11 @@ function HoverCard({ return (
{userCanAddThreadInBlackoutDate && ( -
+
)} - -
+
diff --git a/src/discussions/posts/post/Post.jsx b/src/discussions/posts/post/Post.jsx index 76609eb2..e48e4fe0 100644 --- a/src/discussions/posts/post/Post.jsx +++ b/src/discussions/posts/post/Post.jsx @@ -64,6 +64,12 @@ function Post({ hideReportConfirmation(); }; + const handleBlurEvent = (e) => { + if (!e.currentTarget.contains(e.relatedTarget)) { + setShowHoverCard(false); + } + }; + const actionHandlers = { [ContentActions.EDIT_CONTENT]: () => history.push({ ...location, @@ -96,7 +102,7 @@ function Post({ onMouseEnter={() => setShowHoverCard(true)} onMouseLeave={() => setShowHoverCard(false)} onFocus={() => setShowHoverCard(true)} - onBlur={() => setShowHoverCard(false)} + onBlur={(e) => handleBlurEvent(e)} > )} - {showHoverCard && (
)} -