From b9b3406b281d91185cc0e12795d3f34f15d4dd31 Mon Sep 17 00:00:00 2001 From: Auxa Date: Thu, 19 Jun 2025 05:33:35 +0900 Subject: [PATCH] Fix: Prevent premature focus change in TitleEditor when pressing Enter during IME composition (#730) * fix: Prevents key events during text composition Stops handling title key events when composing text, ensuring proper input behavior during IME use. * Refines IME composition event checks Separates IME composition control from shift key logic and adds a Safari-specific keyCode check to prevent premature focus shifts during IME input. --- apps/client/src/features/editor/title-editor.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/client/src/features/editor/title-editor.tsx b/apps/client/src/features/editor/title-editor.tsx index 33b71b0c..e695867f 100644 --- a/apps/client/src/features/editor/title-editor.tsx +++ b/apps/client/src/features/editor/title-editor.tsx @@ -154,7 +154,11 @@ export function TitleEditor({ function handleTitleKeyDown(event: any) { if (!titleEditor || !pageEditor || event.shiftKey) return; - + + // Prevent focus shift when IME composition is active + // `keyCode === 229` is added to support Safari where `isComposing` may not be reliable + if (event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return; + const { key } = event; const { $head } = titleEditor.state.selection;