fix(tui): clear input after Korean IME submit - #38245
Conversation
|
Thanks for the focused regression fix. Current main still has the unconditional self-echo suppression at The PR branch is behind current main, but the current-main diff from its merge base does not touch this effect hunk; this should be a mechanical salvage. Automated hermes-sweeper review. |
Cherry-pick of PR NousResearch#38245 by sweetcornna. Distinguish a TextInput self-echo from an external controlled-value update so the parent value="" clear after submit actually clears the internal buffer instead of being ignored as a self-echo. Fixes: Korean IME final syllable stuck in input after submit. Closes NousResearch#38117.
When React batches onChange+onSubmit, setValue('') can arrive while
self.current is still true. Since IME never produces empty strings,
treat value==='' as always external — never a self-echo.
Ref: PR NousResearch#38245, Issue NousResearch#38117
…ast syllable When Korean IME commits its final composition and Enter in the same useInput event, the k.return handler fired before the printable-input path, so vRef.current lacked the last composed syllable. The IME commit then landed in the cleared input field, leaving a stranded character. Now the Enter handler checks for pending printable input first and applies it to vRef.current synchronously, so cbSubmit sees the full value. Refs: NousResearch#38117, PR NousResearch#38245
|
Thanks for this fix! It was salvaged into #86761 (cherry-picked onto current main with your authorship preserved in the commit history) and is now merged. Closing since the work has landed. |
Summary
value=""update after submit to clear the internal bufferRoot cause
TextInputusedself.currentto ignore the next controlledvalueupdate after internal edits. When a Korean IME final syllable and Enter arrived together, the parent cleared the value after submit, but the component still treated that clear as its own echo and kept the final syllable in the internal buffer.Closes #38117.
Verification
npm test -- --run src/__tests__/textInputSubmitClear.test.tsx src/__tests__/textInputFastEcho.test.ts src/__tests__/textInputCursorSourceOfTruth.test.ts src/lib/editor.test.tsinui-tui(41 passed)npx eslint src/components/textInput.tsx src/__tests__/textInputSubmitClear.test.tsxinui-tui(exit 0; existing react-compiler warning attextInput.tsx:898)git diff --check origin/main..HEAD