From b45c812030be54521642fe8a905bf67679b595aa Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Tue, 7 Jul 2026 16:52:31 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20Codex=20round=208=20=E2=80=94=20respect?= =?UTF-8?q?=20IME=20composition=20before=20submitting=20answers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit handleComposerKeyDown runs before useTextarea's composition guard, so with a CJK/IME keyboard the Enter that commits an in-progress composition was being intercepted and submitting the partial answer (and the composition buffer can leave value empty mid-compose, mis-triggering digit/arrow steering too). Bail at the top when composing — nativeEvent.isComposing, or key==='Process' / keyCode===229 for Safari's inconsistent reporting — mirroring the existing composer guard so the character commits normally. --- client/src/hooks/Input/useAskAnswerMode.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/src/hooks/Input/useAskAnswerMode.ts b/client/src/hooks/Input/useAskAnswerMode.ts index c21127e7e4..103823ad9f 100644 --- a/client/src/hooks/Input/useAskAnswerMode.ts +++ b/client/src/hooks/Input/useAskAnswerMode.ts @@ -278,6 +278,18 @@ export default function useAskAnswerMode(conversationId?: string | null) { if (!active) { return false; } + /** + * Let IME composition commit normally: with a CJK keyboard, Enter + * commits the in-progress composition rather than submitting, and the + * composition buffer can leave `value` empty mid-compose — so bail + * before ANY Enter-submit or digit/arrow steering. Mirrors the composer + * guard in `useTextarea` (Safari reports `isComposing` inconsistently, + * hence the `key`/`keyCode` fallbacks); this handler runs first, so the + * guard must live here too. + */ + if (e.nativeEvent.isComposing || e.key === 'Process' || e.keyCode === 229) { + return false; + } const composerText = e.currentTarget.value; if (composerText.trim().length > 0) { // The composer IS the free-form answer box: Enter submits the typed