From fe67541d4fe9670113e1ab9df239b05426b50301 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Mon, 26 Aug 2024 19:24:36 +0800 Subject: [PATCH 1/3] Revert "Merge pull request #47718 from Expensify/revert-47486-fix/45524-message-highlight-is-stukck" --- .../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(false, 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 3570e9e5fffe742f3fd664058a1b715a02ff952c Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 27 Aug 2024 16:57:38 +0800 Subject: [PATCH 2/3] set the instance ID when the modal is visible --- .../home/report/ContextMenu/PopoverReportActionContextMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx index 50b424fc736b..48b1b669c7ee 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx @@ -180,7 +180,6 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef { + setInstanceID(Math.random().toString(36).substr(2, 5)); setDisabledActions(disabledOptions); typeRef.current = type; reportIDRef.current = reportID ?? '-1'; From 3be4772d04b76b5f4430f0c90260ed53c1058973 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 27 Aug 2024 18:17:58 +0800 Subject: [PATCH 3/3] set the instance id when the modal show --- .../home/report/ContextMenu/PopoverReportActionContextMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx index 48b1b669c7ee..2c81cb264d16 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx @@ -206,7 +206,6 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef { - setInstanceID(Math.random().toString(36).substr(2, 5)); setDisabledActions(disabledOptions); typeRef.current = type; reportIDRef.current = reportID ?? '-1'; @@ -225,6 +224,7 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef { + setInstanceID(Math.random().toString(36).substr(2, 5)); onPopoverShow.current(); // After we have called the action, reset it.