From a0883854c9ffb00d2bcac5fb2b0859ccad5fd27b Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 12 Sep 2024 18:25:26 +0700 Subject: [PATCH 1/2] disable enter shortcut for web platform --- src/libs/shouldEnableEnterShortcut/index.native.ts | 1 + src/libs/shouldEnableEnterShortcut/index.ts | 1 + .../home/report/ContextMenu/BaseReportActionContextMenu.tsx | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 src/libs/shouldEnableEnterShortcut/index.native.ts create mode 100644 src/libs/shouldEnableEnterShortcut/index.ts diff --git a/src/libs/shouldEnableEnterShortcut/index.native.ts b/src/libs/shouldEnableEnterShortcut/index.native.ts new file mode 100644 index 00000000000..ff3177babdd --- /dev/null +++ b/src/libs/shouldEnableEnterShortcut/index.native.ts @@ -0,0 +1 @@ +export default true; diff --git a/src/libs/shouldEnableEnterShortcut/index.ts b/src/libs/shouldEnableEnterShortcut/index.ts new file mode 100644 index 00000000000..33136544dba --- /dev/null +++ b/src/libs/shouldEnableEnterShortcut/index.ts @@ -0,0 +1 @@ +export default false; diff --git a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx index 58e361d7429..10cd96df4c3 100755 --- a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx @@ -19,6 +19,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; +import shouldEnableEnterShortcut from '@libs/shouldEnableEnterShortcut'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -257,7 +258,7 @@ function BaseReportActionContextMenu({ menuItemRefs.current[focusedIndex]?.triggerPressAndUpdateSuccess?.(); setFocusedIndex(-1); }, - {isActive: shouldEnableArrowNavigation, shouldPreventDefault: false}, + {isActive: shouldEnableArrowNavigation && shouldEnableEnterShortcut, shouldPreventDefault: false}, ); const openOverflowMenu = (event: GestureResponderEvent | MouseEvent, anchorRef: MutableRefObject) => { From a0bfe04daa77c75e683e6a565bd3cfb5201e4577 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 12 Sep 2024 22:30:33 +0700 Subject: [PATCH 2/2] rename --- .../index.native.ts | 0 .../index.ts | 0 .../home/report/ContextMenu/BaseReportActionContextMenu.tsx | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename src/libs/{shouldEnableEnterShortcut => shouldEnableContextMenuEnterShortcut}/index.native.ts (100%) rename src/libs/{shouldEnableEnterShortcut => shouldEnableContextMenuEnterShortcut}/index.ts (100%) diff --git a/src/libs/shouldEnableEnterShortcut/index.native.ts b/src/libs/shouldEnableContextMenuEnterShortcut/index.native.ts similarity index 100% rename from src/libs/shouldEnableEnterShortcut/index.native.ts rename to src/libs/shouldEnableContextMenuEnterShortcut/index.native.ts diff --git a/src/libs/shouldEnableEnterShortcut/index.ts b/src/libs/shouldEnableContextMenuEnterShortcut/index.ts similarity index 100% rename from src/libs/shouldEnableEnterShortcut/index.ts rename to src/libs/shouldEnableContextMenuEnterShortcut/index.ts diff --git a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx index 10cd96df4c3..644adfdd66f 100755 --- a/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/BaseReportActionContextMenu.tsx @@ -19,7 +19,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; -import shouldEnableEnterShortcut from '@libs/shouldEnableEnterShortcut'; +import shouldEnableContextMenuEnterShortcut from '@libs/shouldEnableContextMenuEnterShortcut'; import * as Session from '@userActions/Session'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -258,7 +258,7 @@ function BaseReportActionContextMenu({ menuItemRefs.current[focusedIndex]?.triggerPressAndUpdateSuccess?.(); setFocusedIndex(-1); }, - {isActive: shouldEnableArrowNavigation && shouldEnableEnterShortcut, shouldPreventDefault: false}, + {isActive: shouldEnableArrowNavigation && shouldEnableContextMenuEnterShortcut, shouldPreventDefault: false}, ); const openOverflowMenu = (event: GestureResponderEvent | MouseEvent, anchorRef: MutableRefObject) => {