Skip to content

Composition interrupted in empty text nodes on Android IME #5883

@12joan

Description

@12joan

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:

  1. Enable the Japanese QWERTY keyboard
  2. Go to https://www.slatejs.org/examples/custom-placeholder or any other empty Slate editor (the placeholder isn't required)
  3. Press the "h" key - the underline under "h" disappears after a few milliseconds, indicating composition has ended
  4. Press the "a" key
  5. 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 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. I was mistaken. RestoreDOM does not seem to be the (sole) cause of this issue after all.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions