Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix message highlight stuck when open the 2nd context menu #47486

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
reportIDRef.current = '-1';
reportActionIDRef.current = '-1';
originalReportIDRef.current = '-1';
setInstanceID('');

onPopoverHide.current = runAndResetCallback(onPopoverHide.current);
onPopoverHideActionCallback.current = runAndResetCallback(onPopoverHideActionCallback.current);
Expand Down
48 changes: 26 additions & 22 deletions src/pages/home/report/ContextMenu/ReportActionContextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,33 +123,37 @@ function showContextMenu(
if (!contextMenuRef.current) {
return;
}
const show = () => {
bernhardoj marked this conversation as resolved.
Show resolved Hide resolved
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();
}

/**
Expand Down
Loading