From fb65ec49aa5fb8793b269c0a8832d537a7b62ce0 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 15 Aug 2024 15:48:11 +0800 Subject: [PATCH 1/2] fix message highlight stuck when open the 2nd context menu --- .../PopoverReportActionContextMenu.tsx | 1 + .../ContextMenu/ReportActionContextMenu.ts | 48 ++++++++++--------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx index 5cfce625201e..50b424fc736b 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx @@ -242,6 +242,7 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef { + contextMenuRef.current?.showContextMenu( + type, + event, + selection, + contextMenuAnchor, + reportID, + reportActionID, + originalReportID, + draftMessage, + onShow, + onHide, + isArchivedRoom, + isChronosReport, + isPinnedChat, + isUnreadChat, + disabledActions, + shouldCloseOnTarget, + setIsEmojiPickerActive, + isOverflowMenu, + ); + }; + // If there is an already open context menu, close it first before opening // a new one. if (contextMenuRef.current.instanceID) { - hideContextMenu(); - contextMenuRef.current.runAndResetOnPopoverHide(); + hideContextMenu(undefined, show); + return; } - contextMenuRef.current.showContextMenu( - type, - event, - selection, - contextMenuAnchor, - reportID, - reportActionID, - originalReportID, - draftMessage, - onShow, - onHide, - isArchivedRoom, - isChronosReport, - isPinnedChat, - isUnreadChat, - disabledActions, - shouldCloseOnTarget, - setIsEmojiPickerActive, - isOverflowMenu, - ); + show(); } /** From eb6df22faed9e578face00b8bfdf7b6cf17604dd Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 16 Aug 2024 14:32:49 +0800 Subject: [PATCH 2/2] pass false instead of undefined --- src/pages/home/report/ContextMenu/ReportActionContextMenu.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ContextMenu/ReportActionContextMenu.ts b/src/pages/home/report/ContextMenu/ReportActionContextMenu.ts index 253be2ee36f5..df500a967cfd 100644 --- a/src/pages/home/report/ContextMenu/ReportActionContextMenu.ts +++ b/src/pages/home/report/ContextMenu/ReportActionContextMenu.ts @@ -149,7 +149,7 @@ function showContextMenu( // If there is an already open context menu, close it first before opening // a new one. if (contextMenuRef.current.instanceID) { - hideContextMenu(undefined, show); + hideContextMenu(false, show); return; }