Skip to content

Android Chinese Input Issue: Backspace requires two presses to trigger one onChange event #5984

Description

@XXPermanentXX

Description
When using a Chinese Input Method Editor (IME) on Android devices, pressing the backspace/delete key requires two presses to trigger a single onChange event. This means users need to tap delete twice to actually delete once.

This issue occurs:

  • On any Android device
  • In any browser (Chrome, Firefox, Samsung Internet, etc.)
  • With any Chinese IME (Gboard Chinese, Sogou, Baidu, etc.)
  • With the simplest possible Slate setup (no custom plugins)

The issue does NOT occur:

  • On iOS devices
  • On desktop browsers
  • When using English keyboard on Android (in some cases)

Recording
https://github.com/user-attachments/assets/208ed8df-cc72-4339-ad1e-d4867891f9db

Steps
To reproduce the behavior:

  1. Open the Slate editor on an Android device
  2. Switch to a Chinese IME (e.g., Gboard Chinese)
  3. Type some text (e.g., "12345")
  4. Press the backspace/delete key
  5. Observe that onChange is not triggered on the first press
  6. Press backspace again
  7. Now onChange is triggered, and two characters are deleted at once (e.g., "123")

Expectation
Each backspace press should:

  1. Delete exactly one character
  2. Trigger one onChange event immediately
    This is how other editors (Google Docs, Notion, Medium) handle backspace on Android Chinese IME.

Environment

  • Slate Version: 120.0
  • Operating System: Android 14
  • Code:
const PlainTextExample = () => {
    const editor = useMemo(() => withReact(createEditor()), []);
    return (
      <Slate editor={editor} initialValue={initialValue} onChange={(value) => {
        console.log('=======PlainTextExample onValueChange', CreationPromptModel.descendantToString(value));
      }}>
        <Editable placeholder="Enter some plain text..." />
      </Slate>
    )
  }
  
  const initialValue: Descendant[] = [
    {
      type: 'paragraph',
      children: [
        { text: 'This is editable plain text, just like a <textarea>!' },
      ],
    },
  ]

  export default PlainTextExample

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions