fix(desktop): show send button for committed IME text (Chinese/Japanese/Korean) - #40210
Merged
Conversation
…button appears Typing committed multi-character IME text (e.g. Chinese "你好", and equally Japanese/Korean or any IME-composed script) left the send button hidden until an unrelated edit. Input events during composition carry uncommitted preedit text and are intentionally skipped; the code assumed a trailing input event after compositionend would deliver the finalized text, but Chromium does not reliably emit one on Windows IMEs. The committed text therefore never reached composer state, so `hasComposerPayload` stayed false and the send button stayed hidden (deleting a char fired a non-composition input that finally synced it). Flush the live editor text into composer state in onCompositionEnd. Extract the shared sync into flushEditorToDraft so input and compositionend both update state. Fixes #39614
…anese/Korean) DOM repro that drives compositionstart -> input(preedit) -> compositionend with no trailing input event and asserts the composer payload (send button) becomes visible for committed CJK/IME input. Regression guard for #39614.
The new IME repro test has two it() blocks but the desktop suite registers
no global testing-library auto-cleanup, so the first render() leaked its
editor into the second test and getByTestId('editor') matched two nodes.
Add afterEach(cleanup) so each case renders into a fresh DOM.
Contributor
🔎 Lint report:
|
4 tasks
tonydwb
approved these changes
Jun 6, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Approved. Fixes IME composition commit bug with regression test harness that mirrors real Chromium event order. Well-scoped, clear test coverage for Korean/CJK input.
This was referenced Jun 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Committed IME text (Chinese/Japanese/Korean) now makes the desktop send button appear immediately, instead of staying hidden until an unrelated edit.
Salvage of #39650 by @xxxigm onto current
main, with a one-line test-isolation follow-up.Root cause
The composer's send-button visibility is driven by
hasComposerPayload(reads AUI composer state).onInputintentionally skips state writes whilecomposingRefis true, on the assumption that a trailinginputevent fires aftercompositionend. Chromium (Electron renderer) does not reliably emit that trailing event on Windows IMEs, so committed text lands in the DOM but never reaches composer state — the button stays hidden until a non-composition edit (e.g. Backspace) forces a sync. Confirmed live onmain:onCompositionEndonly setcomposingRef = false.Changes
apps/desktop/src/app/chat/composer/index.tsx: extract the per-keystroke sync into a sharedflushEditorToDraft(editor), called from bothonInputandonCompositionEnd. Committed IME text now reaches state through whichever event the platform delivers. (@xxxigm)ime-composition-dom-repro.test.tsx: real-DOM repro drivingcompositionstart → input(preedit) → compositionendwith no trailing input event; asserts the send button becomes visible for你好,こんにちは,안녕하세요. (@xxxigm)afterEach(cleanup)to the test — the desktop suite registers no global testing-library auto-cleanup, so the twoit()blocks leaked editors across renders andgetByTestId('editor')matched multiple nodes. (teknium1)Validation
你好(no further edit)vitestime-composition-dom-reprotsc -b(desktop)Closes #39614. Original PR #39650.
Infographic