fix: prevent duplicate submissions during IME composition

This commit is contained in:
cgoing
2025-03-21 13:33:55 +09:00
parent 35fbb5c40c
commit 2e069d0819

View File

@@ -339,7 +339,12 @@ export function Thread() {
value={input} value={input}
onChange={(e) => setInput(e.target.value)} onChange={(e) => setInput(e.target.value)}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === "Enter" && !e.shiftKey && !e.metaKey) { if (
e.key === "Enter" &&
!e.shiftKey &&
!e.metaKey &&
!e.nativeEvent.isComposing
) {
e.preventDefault(); e.preventDefault();
const el = e.target as HTMLElement | undefined; const el = e.target as HTMLElement | undefined;
const form = el?.closest("form"); const form = el?.closest("form");