Skip to content

fix(desktop): IME composition prevents send button from switching to arrow - #39918

Closed
chenyf1010 wants to merge 1 commit into
NousResearch:mainfrom
chenyf1010:fix/ime-composition-send-button
Closed

fix(desktop): IME composition prevents send button from switching to arrow#39918
chenyf1010 wants to merge 1 commit into
NousResearch:mainfrom
chenyf1010:fix/ime-composition-send-button

Conversation

@chenyf1010

@chenyf1010 chenyf1010 commented Jun 5, 2026

Copy link
Copy Markdown

Summary

Fix CJK IME composition causing the send button to stay as microphone icon instead of switching to the up-arrow after Chinese/Japanese/Korean input.

Root Cause

The onCompositionEnd handler only set composingRef.current = false without syncing the composer state with the final DOM content. As a result, draft stays empty, hasComposerPayload remains false, and the button stays as voice/microphone icon.

Fix

Added state sync logic in onCompositionEnd that reads the final committed text from the editor DOM and pushes it to aui.composer().setText(). The sync is wrapped in setTimeout(0) to avoid React 18 automatic batching swallowing the state update.

Test Plan

  • Type Chinese characters using IME in Hermes Desktop -> verify send button switches to up-arrow immediately
  • Type English text normally -> no regression
  • Start a voice conversation -> no regression on microphone button

…arrow

After CJK IME composition ends, the composer state was not synced
with the DOM content, causing the send button to remain as the
voice/microphone icon instead of switching to the up-arrow.

The onCompositionEnd handler now defers the state sync via setTimeout(0)
to avoid React 18 automatic batching swallowing the state update,
ensuring the send-button icon updates immediately after IME input.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have labels Jun 5, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the IME-focused report and proposed fix. This is an automated hermes-sweeper review; the requested behavior is already implemented on current main.

  • apps/desktop/src/app/chat/composer/index.tsx:727 clears the composition flag and synchronously calls flushEditorToDraft(event.currentTarget).
  • apps/desktop/src/app/chat/composer/index.tsx:262 serializes the finalized editor DOM and updates both draftRef and the assistant-ui composer state that drives hasComposerPayload.
  • The equivalent fix landed as 8e629b9f386d12b726bccb32e9d7b48402ea73ea (fix(desktop): flush committed IME text on compositionend so the send button appears) and is covered by apps/desktop/src/app/chat/composer/ime-composition-dom-repro.test.tsx:61.

Closing as implemented on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants