From 2a537f15232ae5f72f747b6a12933639ca19853a Mon Sep 17 00:00:00 2001 From: Philip Zeyliger Date: Mon, 5 Jan 2026 06:30:54 +0000 Subject: [PATCH] shelley/ui: fix IME character conversion triggering form submission Prompt: In a new worktree, reset to origin/main, and fix https://github.com/boldsoftware/exe.dev/issues/71 When using an IME (Input Method Editor) for Japanese/Chinese input, pressing Enter to confirm character conversion (e.g., hiragana to kanji) was causing unintended form submissions. The fix checks KeyboardEvent.isComposing before handling Enter key events, which is the standard way to detect if an IME composition is in progress. Fixes boldsoftware/exe.dev#71 --- ui/src/components/ConversationDrawer.tsx | 4 ++++ ui/src/components/DirectoryPickerModal.tsx | 4 ++++ ui/src/components/MessageInput.tsx | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/ui/src/components/ConversationDrawer.tsx b/ui/src/components/ConversationDrawer.tsx index 9165cd687f272e9ce2e6e5a8a49968e8c2426727..d0e84eabc7a54d7820757a436522018ed08f061a 100644 --- a/ui/src/components/ConversationDrawer.tsx +++ b/ui/src/components/ConversationDrawer.tsx @@ -172,6 +172,10 @@ function ConversationDrawer({ }; const handleRenameKeyDown = (e: React.KeyboardEvent, conversationId: string) => { + // Don't submit while IME is composing (e.g., converting Japanese hiragana to kanji) + if (e.nativeEvent.isComposing) { + return; + } if (e.key === "Enter") { e.preventDefault(); handleRename(conversationId); diff --git a/ui/src/components/DirectoryPickerModal.tsx b/ui/src/components/DirectoryPickerModal.tsx index e5ab16ebd71e398bcb4cda66326d601ed3646011..966c762e66e05fb9e9868d44bcd76fea2ea0e897 100644 --- a/ui/src/components/DirectoryPickerModal.tsx +++ b/ui/src/components/DirectoryPickerModal.tsx @@ -172,6 +172,10 @@ function DirectoryPickerModal({ }; const handleInputKeyDown = (e: React.KeyboardEvent) => { + // Don't submit while IME is composing (e.g., converting Japanese hiragana to kanji) + if (e.nativeEvent.isComposing) { + return; + } if (e.key === "Enter") { e.preventDefault(); handleSelect(); diff --git a/ui/src/components/MessageInput.tsx b/ui/src/components/MessageInput.tsx index f0e5b750c58d4ac0942e36463b0617ec0535a63e..41209d9ea7e9cf163c5b87dc5fe9783c4fed663f 100644 --- a/ui/src/components/MessageInput.tsx +++ b/ui/src/components/MessageInput.tsx @@ -304,6 +304,10 @@ function MessageInput({ }; const handleKeyDown = (e: React.KeyboardEvent) => { + // Don't submit while IME is composing (e.g., converting Japanese hiragana to kanji) + if (e.nativeEvent.isComposing) { + return; + } if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); handleSubmit(e);