From d57dcb541716bc79828db698ed37b7c40e06b291 Mon Sep 17 00:00:00 2001 From: soundflora* Date: Thu, 9 Mar 2023 20:23:02 +0900 Subject: [PATCH] Do not send messages when confirming an input method selection When using a CJK input method, the enter key is used to confirm the current conversion, so it shouldn't send the message yet. Normally this can be checked with the isComposing property of the native event, but that doesn't work on Safari on macOS. Instead, check for keyCode 229, which is what you get when confirming conversions, and ignore it. --- src/app/organisms/room/RoomViewInput.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/organisms/room/RoomViewInput.jsx b/src/app/organisms/room/RoomViewInput.jsx index c43eb601..9a90b2b5 100644 --- a/src/app/organisms/room/RoomViewInput.jsx +++ b/src/app/organisms/room/RoomViewInput.jsx @@ -296,7 +296,7 @@ function RoomViewInput({ roomsInput.cancelReplyTo(roomId); setReplyTo(null); } - if (e.key === 'Enter' && e.shiftKey === false) { + if (e.key === 'Enter' && e.shiftKey === false && e.keyCode !== 229) { e.preventDefault(); sendMessage(); }