From a533d7b57d99be6fc9c18227be37baa0f656857a Mon Sep 17 00:00:00 2001
From: tienifr <christianwen18@gmail.com>
Date: Mon, 17 Apr 2023 17:37:32 +0700
Subject: [PATCH 1/4] fix: redundant context menu on error report item

---
 src/pages/home/report/ReportActionItem.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index c4e7d6c5fe69..4b29b08031d1 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -124,8 +124,8 @@ class ReportActionItem extends Component {
      * @param {Object} [event] - A press event.
      */
     showPopover(event) {
-        // Block menu on the message being Edited
-        if (this.props.draftMessage) {
+        // Block menu on the message being Edited or if the report item has errors
+        if (this.props.draftMessage || !_.isEmpty(this.props.action.errors)) {
             return;
         }
 
@@ -239,6 +239,9 @@ class ReportActionItem extends Component {
         if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.CHRONOSOOOLIST) {
             return <ChronosOOOListActions action={this.props.action} reportID={this.props.report.reportID} />;
         }
+
+        const hasErrors = !_.isEmpty(this.props.action.errors);
+
         return (
             <PressableWithSecondaryInteraction
                 pointerEvents={this.props.action.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ? 'none' : 'auto'}
@@ -297,6 +300,7 @@ class ReportActionItem extends Component {
                                 isVisible={
                                     hovered
                                     && !this.props.draftMessage
+                                    && !hasErrors
                                 }
                                 draftMessage={this.props.draftMessage}
                                 isChronosReport={ReportUtils.chatIncludesChronos(this.props.report)}

From ce87870b4a8a8203ee81cd1cf9a3863418ee7263 Mon Sep 17 00:00:00 2001
From: tienifr <christianwen18@gmail.com>
Date: Thu, 20 Apr 2023 11:40:28 +0700
Subject: [PATCH 2/4] open default context menu on error report item

---
 src/pages/home/report/ReportActionItem.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index 4b29b08031d1..4c0723f85762 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -249,7 +249,7 @@ class ReportActionItem extends Component {
                 onPressIn={() => this.props.isSmallScreenWidth && DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()}
                 onPressOut={() => ControlSelection.unblock()}
                 onSecondaryInteraction={this.showPopover}
-                preventDefaultContentMenu={!this.props.draftMessage}
+                preventDefaultContentMenu={!this.props.draftMessage && !hasErrors}
                 withoutFocusOnSecondaryInteraction
             >
                 <Hoverable>

From 8579b243c186f92ae21d4e4fe9287f50ff0e3060 Mon Sep 17 00:00:00 2001
From: tienifr <christianwen18@gmail.com>
Date: Thu, 20 Apr 2023 17:21:16 +0700
Subject: [PATCH 3/4] fix prop name typo

---
 src/components/PressableWithSecondaryInteraction/index.js     | 2 +-
 .../pressableWithSecondaryInteractionPropTypes.js             | 4 ++--
 src/pages/home/report/ReportActionItem.js                     | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/components/PressableWithSecondaryInteraction/index.js b/src/components/PressableWithSecondaryInteraction/index.js
index f3ea25a471fd..f90a09e06c4d 100644
--- a/src/components/PressableWithSecondaryInteraction/index.js
+++ b/src/components/PressableWithSecondaryInteraction/index.js
@@ -31,7 +31,7 @@ class PressableWithSecondaryInteraction extends Component {
      */
     executeSecondaryInteractionOnContextMenu(e) {
         e.stopPropagation();
-        if (this.props.preventDefaultContentMenu) {
+        if (this.props.preventDefaultContextMenu) {
             e.preventDefault();
         }
 
diff --git a/src/components/PressableWithSecondaryInteraction/pressableWithSecondaryInteractionPropTypes.js b/src/components/PressableWithSecondaryInteraction/pressableWithSecondaryInteractionPropTypes.js
index bffe11bc4cd8..b9192bf0b2b2 100644
--- a/src/components/PressableWithSecondaryInteraction/pressableWithSecondaryInteractionPropTypes.js
+++ b/src/components/PressableWithSecondaryInteraction/pressableWithSecondaryInteractionPropTypes.js
@@ -20,7 +20,7 @@ const propTypes = {
     forwardedRef: PropTypes.func,
 
     /** Prevent the default ContextMenu on web/Desktop */
-    preventDefaultContentMenu: PropTypes.bool,
+    preventDefaultContextMenu: PropTypes.bool,
 
     /** Use Text instead of Pressable to create inline layout.
      * It has few limitations in comparison to Pressable.
@@ -40,7 +40,7 @@ const defaultProps = {
     forwardedRef: () => {},
     onPressIn: () => {},
     onPressOut: () => {},
-    preventDefaultContentMenu: true,
+    preventDefaultContextMenu: true,
     inline: false,
     withoutFocusOnSecondaryInteraction: false,
 };
diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index 4c0723f85762..bc68752bf659 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -249,7 +249,7 @@ class ReportActionItem extends Component {
                 onPressIn={() => this.props.isSmallScreenWidth && DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()}
                 onPressOut={() => ControlSelection.unblock()}
                 onSecondaryInteraction={this.showPopover}
-                preventDefaultContentMenu={!this.props.draftMessage && !hasErrors}
+                preventDefaultContextMenu={!this.props.draftMessage && !hasErrors}
                 withoutFocusOnSecondaryInteraction
             >
                 <Hoverable>

From eef6d62b4c4b6dc7ff221b7d6ffcfc55a5a3be45 Mon Sep 17 00:00:00 2001
From: tienifr <christianwen18@gmail.com>
Date: Fri, 21 Apr 2023 10:47:17 +0700
Subject: [PATCH 4/4] modify comment

---
 src/pages/home/report/ReportActionItem.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index bc68752bf659..da2305f9cd04 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -124,7 +124,7 @@ class ReportActionItem extends Component {
      * @param {Object} [event] - A press event.
      */
     showPopover(event) {
-        // Block menu on the message being Edited or if the report item has errors
+        // Block menu on the message being Edited or if the report action item has errors
         if (this.props.draftMessage || !_.isEmpty(this.props.action.errors)) {
             return;
         }
