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.
This commit is contained in:
soundflora* 2023-03-09 20:23:02 +09:00
parent e446fc47ce
commit d57dcb5417

View file

@ -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();
}