From 30a550133e80ff0a7487c773a89b91215da1b994 Mon Sep 17 00:00:00 2001 From: Riya Amemiya Date: Tue, 20 Aug 2024 02:54:21 +0900 Subject: [PATCH 1/2] fix(chat): prevent Enter key action during IME composition --- apps/postgres-new/components/chat.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/postgres-new/components/chat.tsx b/apps/postgres-new/components/chat.tsx index 7f1c87b..b1148d2 100644 --- a/apps/postgres-new/components/chat.tsx +++ b/apps/postgres-new/components/chat.tsx @@ -506,6 +506,11 @@ export default function Chat() { return } + if ( e.nativeEvent.isComposing ) + { + return + } + if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault() if (!isLoading && isSubmitEnabled) { From 55117ec7bea7bb5dfd50552335ca27b3af565958 Mon Sep 17 00:00:00 2001 From: Yuta Nishi Date: Tue, 20 Aug 2024 16:12:08 +0900 Subject: [PATCH 2/2] fix(chat): combine Enter key checks to prevent form submission during composition --- apps/postgres-new/components/chat.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/postgres-new/components/chat.tsx b/apps/postgres-new/components/chat.tsx index b1148d2..19299ee 100644 --- a/apps/postgres-new/components/chat.tsx +++ b/apps/postgres-new/components/chat.tsx @@ -506,12 +506,7 @@ export default function Chat() { return } - if ( e.nativeEvent.isComposing ) - { - return - } - - if (e.key === 'Enter' && !e.shiftKey) { + if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) { e.preventDefault() if (!isLoading && isSubmitEnabled) { handleFormSubmit(e)