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:
- Open the Slate editor on an Android device
- Switch to a Chinese IME (e.g., Gboard Chinese)
- Type some text (e.g., "12345")
- Press the backspace/delete key
- Observe that onChange is not triggered on the first press
- Press backspace again
- Now onChange is triggered, and two characters are deleted at once (e.g., "123")
Expectation
Each backspace press should:
- Delete exactly one character
- 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
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:
The issue does NOT occur:
Recording
https://github.com/user-attachments/assets/208ed8df-cc72-4339-ad1e-d4867891f9db
Steps
To reproduce the behavior:
Expectation
Each backspace press should:
This is how other editors (Google Docs, Notion, Medium) handle backspace on Android Chinese IME.
Environment