Phenomenon
When using certain IMEs (Input Method Editors) like Chinese IME in Safari, composition events (compositionstart, compositionupdate, compositionend) may not fire consistently or may fire in an unexpected order.
Reproduction example
- Create a contenteditable div.
- Add event listeners for
compositionstart,compositionupdate, andcompositionend. - Switch to Chinese IME.
- Start typing Chinese characters.
- Observe which events fire and in what order.
Observed behavior
- In Safari on macOS with Chinese IME, composition events may not fire for all keystrokes.
- The event order may be inconsistent.
- Some composition operations may complete without firing
compositionend.
Expected behavior
- Composition events should fire consistently for all IMEs.
- The event order should be predictable:
compositionstart→compositionupdate(multiple) →compositionend. - All composition operations should properly signal their completion.