[lexical] Bug Fix: Handle iOS 10-key Korean IME deleteContentBackward with targetRange#8475
Conversation
|
Hi @kotom320! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
left a comment
There was a problem hiding this comment.
It would be great if this also added some kind of test to confirm that the behavior is more correct. Note that we can't do anything with this until the CLA is signed (there is some delay for the bot to confirm it)
|
Test suggestion from a Korean user — the case worth nailing is the text-node boundary, when the IME range straddles two text nodes mid-composition. That's where IME bugs tend to hide in this area. |
|
If the CLA isn't signed we will have to close this eventually but I would be happy to review another attempt at this fix by a contributor who can sign the CLA especially if it includes tests. |
aa2a35b to
cd27fc3
Compare
|
@etrepum |
|
@mayrang since it sounds like you are familiar with this Korean IME do you have any opinions on this solution and how it behaves in the playground? https://lexical-playground-git-fork-kotom320-fix-io-590d2a-fbopensource.vercel.app/ It's tricky for me to validate that it behaves as expected as I have no fluency in Korean |
etrepum
left a comment
There was a problem hiding this comment.
The code looks reasonable to me, the behavior certainly seems like an improvement over the current playground, but I am unsure if it exactly matches the expectations of someone familiar with this language and IME. Will hold off on merging for a bit for a second opinion but approving in the meantime.
|
@etrepum — checked on iOS Safari with the built-in 10키 (천지인) Korean keyboard.
Third-party Korean keyboard apps (Naver SmartBoard, etc.) don't go through this code path — they use a different IME route — so they're unaffected either way. The fix is targeting the iOS built-in 10키 case, which is the only option for users who don't install a third-party keyboard. Side note: iOS 10-key diverges from Android 10-key and from other Korean IMEs at both the browser event layer (no |
|
@mayrang thank you, I will merge this as-is as it's a clear improvement! Please feel free assist or offer PRs on any other IME issue since you have a lot more domain knowledge than most of the active maintainers |
|
Thanks @etrepum. Will keep an eye on the IME-tagged issues and chime in when there's something concrete to add. |
Description
The iOS 10-key (천지인/Chunjiin) Korean keyboard does not fire
compositionstart/compositionendevents. Instead, each syllable composition step sends:beforeinputdeleteContentBackwardwith a non-collapsedtargetRange— to erase the current in-progress syllablebeforeinputinsertText— to insert the updated syllableBecause
editor.isComposing()is alwaysfalsefor this keyboard type, Lexical falls through toDELETE_CHARACTER_COMMAND, which ignorestargetRangeentirely and deletes one character before the cursor. The wrong character is deleted, and orphaned jamo accumulate in the editor state with each composition step.This PR adds a guard in the
deleteContentBackwardhandler: when on iOS with a non-collapsedtargetRange, callselection.applyDOMRange(targetRange)andremoveText()to delete exactly the range the IME requested, then return early.If
applyDOMRangecannot resolve the range (collapsed result), the code falls through to the existing path unchanged.targetRangeandIS_IOSare already in scope at the call site — no new imports or dependencies needed.Test plan
Before
Typing 안녕하세요 on iOS 10-key (천지인) keyboard produces corrupted output: 안녕하ᄉ세 ᄋᄋ요 (orphaned jamo appear equal to the number of dot presses per vowel)
ScreenRecording_05-07-2026.17-38-05_1.MOV
After
Typing 안녕하세요 on iOS 10-key (천지인) keyboard produces correct output: 안녕하세요