From b898319e74c6227109eb23105aa907abcae671e0 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 14 Jan 2026 17:44:29 +0700 Subject: [PATCH 1/2] fix: The Add category page reopens after saving New Category with the Enter/Return key --- .../KeyboardShortcut/isEnterWhileComposition.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/libs/KeyboardShortcut/isEnterWhileComposition.ts b/src/libs/KeyboardShortcut/isEnterWhileComposition.ts index 71ec27f21c13..8d3466ba9ae9 100644 --- a/src/libs/KeyboardShortcut/isEnterWhileComposition.ts +++ b/src/libs/KeyboardShortcut/isEnterWhileComposition.ts @@ -19,7 +19,19 @@ const isEnterWhileComposition = (event: KeyboardEvent | React.KeyboardEvent): bo return event.keyCode === 229; } - return event.key === CONST.KEYBOARD_SHORTCUTS.ENTER.shortcutKey && (event as unknown as NativeSyntheticEvent)?.nativeEvent?.isComposing; + // Check if this is a native KeyboardEvent (has isComposing directly) or a React synthetic event (has nativeEvent.isComposing) + // For native KeyboardEvent, isComposing is directly on the event + // For React synthetic events, it's on event.nativeEvent.isComposing + let isComposing: boolean | undefined; + + if (event instanceof KeyboardEvent) { + isComposing = event.isComposing; + } else { + const nativeEvent = (event as unknown as NativeSyntheticEvent)?.nativeEvent; + isComposing = nativeEvent?.isComposing; + } + + return event.key === CONST.KEYBOARD_SHORTCUTS.ENTER.shortcutKey && !!isComposing; }; export default isEnterWhileComposition; From 5209e0dfcf608432ccd9cce75df085a0c8b572f2 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 4 Feb 2026 10:27:36 +0700 Subject: [PATCH 2/2] disable eslint --- src/libs/KeyboardShortcut/isEnterWhileComposition.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/KeyboardShortcut/isEnterWhileComposition.ts b/src/libs/KeyboardShortcut/isEnterWhileComposition.ts index 8d3466ba9ae9..6e65ee96aff1 100644 --- a/src/libs/KeyboardShortcut/isEnterWhileComposition.ts +++ b/src/libs/KeyboardShortcut/isEnterWhileComposition.ts @@ -16,6 +16,7 @@ const isEnterWhileComposition = (event: KeyboardEvent | React.KeyboardEvent): bo // On Safari, isComposing returns false on Enter keypress event even for IME confirmation. Although keyCode is deprecated, // reading keyCode is the only way available to distinguish Enter keypress event for IME confirmation. if (CONST.BROWSER.SAFARI === Browser.getBrowser()) { + // eslint-disable-next-line @typescript-eslint/no-deprecated return event.keyCode === 229; }