Phenomenon
When editing Chinese text with Pinyin IME in a contenteditable element, pressing Backspace removes the entire character instead of allowing component-level editing. This makes fine-grained correction difficult and differs from native input fields on the same platform.
Reproduction example
- Focus the editable area.
- Activate Chinese Pinyin IME.
- Type a Chinese character (e.g., “你好”).
- Press Backspace once.
Observed behavior
- The entire character is removed by a single Backspace press
- Component-level editing (e.g., editing Pinyin components) is not possible
- The event log shows only one
beforeinput/inputpair for the deletion - Behavior differs from native input fields
Expected behavior
- Each Backspace press should allow more granular deletion, matching how native inputs behave
- Component-level editing should be possible
- Behavior should be consistent with native input fields
Browser Comparison
- Safari: May remove entire characters instead of components, especially on macOS
- Chrome: May have different granularity behavior
- Firefox: May have different granularity behavior
Notes and possible direction for workarounds
- Compare behavior with a plain
<input>element in the same environment to confirm the difference - This behavior can affect cursor movement, undo granularity, and diff calculation
- Consider implementing custom backspace handling for finer control