Japanese IME Undo during composition clears more text than expected
OS: macOS 14.0 · Device: Desktop or Laptop Any · Browser: Safari 17.0
Open case →Scenario
Pressing Undo or Redo while IME composition is active can cancel composition, leave partial syllables, or corrupt the undo stack. Behavior differs by browser and by whether the editor uses native undo or a custom history layer.
Pressing Undo or Redo while IME composition is active can cancel composition, leave partial syllables, or corrupt the undo stack. Behavior differs by browser and by whether the editor uses native undo or a custom history layer.
Composition is a transient state; undo systems expect discrete transactions. Mixing the two produces undefined interactions in the HTML editing spec space.
Lost input, confused users, and hard-to-reproduce bugs in Korean/Japanese/Chinese workflows.
Chromium, WebKit, and Gecko differ; mobile keyboards add variance.
isComposing, optionally block undo/redo shortcuts or queue them until compositionend.Visual view of how this scenario connects to its concrete cases and environments. Nodes can be dragged and clicked.
Each row is a concrete case for this scenario, with a dedicated document and playground.
| Case | OS | Device | Browser | Keyboard | Status |
|---|---|---|---|---|---|
| ce-0007-undo-breaks-composition | Windows 11 | Desktop or Laptop Any | Chrome 120.0 | Korean (IME) | draft |
| ce-0208-korean-ime-undo-composition-chrome | Windows 11 | Desktop or Laptop Any | Chrome 120.0 | Korean (IME) | draft |
| ce-0209-japanese-ime-undo-composition-safari | macOS 14.0 | Desktop or Laptop Any | Safari 17.0 | Japanese (IME) | draft |
This matrix shows which browser and OS combinations have documented cases for this scenario. Click on a cell to view the specific case.
| Browser | Windows | macOS |
|---|---|---|
| Chrome | — | |
| Safari | — |
This scenario affects multiple languages. Cases are grouped by language/input method below.
OS: macOS 14.0 · Device: Desktop or Laptop Any · Browser: Safari 17.0
Open case →OS: Windows 11 · Device: Desktop or Laptop Any · Browser: Chrome 120.0
Open case →OS: Windows 11 · Device: Desktop or Laptop Any · Browser: Chrome 120.0
Open case →Other scenarios that share similar tags or category.
During IME composition or in certain browser/IME combinations, the beforeinput event may have a different inputType than the corresponding input event. For example, beforeinput may fire with insertCompositionText while input fires with deleteContentBackward. This mismatch can cause handlers to misinterpret the actual DOM change and requires storing beforeinput's targetRanges for use in input event handling.
The selection (window.getSelection()) in beforeinput events can differ from the selection in corresponding input events. This mismatch can occur during IME composition, text prediction, or when typing adjacent to formatted elements like links. The selection in beforeinput may include adjacent formatted text, while input selection reflects the final cursor position.
Some beforeinput events during IME composition cannot be canceled per spec or implementation—calling preventDefault may throw or be ignored, so editors cannot always block native insertion.
Analysis of how out-of-order or missing composition events disrupt editor state synchronization.
The getTargetRanges() method in beforeinput events may return an empty array or undefined in various scenarios, including text prediction, certain IME compositions, or specific browser/device combinations. When getTargetRanges() is unavailable, developers must rely on window.getSelection() as a fallback, but this may be less accurate.
Have questions, suggestions, or want to share your experience? Join the discussion below.