-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Description
When using a Japanese IME on Android (I'm using Gboard), composition ends early when typing in empty leaves (including empty text nodes and leaves created by editor.marks
).
Recording
image.mp4
Steps
To reproduce the behavior:
- Enable the Japanese QWERTY keyboard
- Go to https://www.slatejs.org/examples/custom-placeholder or any other empty Slate editor (the placeholder isn't required)
- Press the "h" key - the underline under "h" disappears after a few milliseconds, indicating composition has ended
- Press the "a" key
- The editor now contains "hあ"
Expectation
Composition should not end, and the editor should contain "は" (the result of composing "h" and "a").
Environment
slate-react
: 0.114.2- Operating System: Android (reproducible in all versions, tested up to 15.0)
- Browser: Chrome
- Keyboard: Gboard 14.2
Context
Potentially related: #4400
This problem happens because the I was mistaken. restoreDOM
method of RestoreDOMManager
removes the DOM text node the user is currently typing in, replacing it with the <br>
from the previous render. Disabling RestoreDOM
fixes the problem, although the correct solution would probably involve checking some condition inside restoreDOM
to determine whether to skip undoing the mutation.RestoreDOM
does not seem to be the (sole) cause of this issue after all.