Bug: Unable to input any CJK language with google input tool
Lexical version: 0.10.0
Steps To Reproduce
- Install Google input tool at google chrome store https://chrome.google.com/webstore/detail/google-input-tools/mclkkofklkfljcocdinagocijmpgbhab
- Open playground
- Enable a CJK language (e.g Cantonese)
- Enter any word (e.g neihou for 你好)
- Caret flashes but cannot input any word
https://github.com/facebook/lexical/assets/46393179/5c802f68-c28e-484c-81b4-a1645812d2f4
Link to code example:
The current behavior
It seems like that any input made by using the input suggestion will bugged. I wonder if this may relate to https://github.com/facebook/lexical/pull/3846 because the bug visually look the same
The expected behavior
The word can be entered properly
Your code pointer is spot on, it always happens at start of line which is when we have to run additional logic to fix inconsistencies and also create the first TextNode when this doesn't exist.
Unfortunately, I can't think of an easy way to target this event, besides maybe doing document.getElementByID('GOOGLE_INPUT_CHEXT_FLAG')
Perhaps we should invert the logic to have if (IS_ANDROID) instead but we'd have to test this logic carefully on Windows and Linux not to cause a major regression.
For reference, this is the PR that added it https://github.com/facebook/lexical/pull/1661/
submitted a fix at https://github.com/facebook/lexical/pull/4783
@zurfyx bumping on this issue because I can't type with googleIME in all product that uses lexical :( Please check the PR if this is good enough to patch for now 🙏
Hi @kalvin807, do you still encounter CJK input problems with Google Input Tools?
It seems to work for me now, at least on Google Chrome 125.0.6422.176 on macOS.
https://github.com/facebook/lexical/assets/25148955/d4101dfc-a92a-4e37-8d9c-e1d19eadc842
PR #4783 (the proposed fix) was closed without merging, and a commenter confirmed this works on Chrome 125 (June 2024). Tested again with Google Input Tools on the latest Chrome — CJK input works correctly.
The relevant Lexical code path ($updateTextNodeFromDOMContent's empty text node removal branch) did not change between v0.10.0 and the time it started working, so this was not fixed on the Lexical side. If there are no further reproduction reports, this can probably be closed.