IME
Composition input for CJK, emoji keyboards, and mobile autocorrect.
IME composition is handled in the substrate. During composition the browser owns the active span; on compositionend the substrate synthesizes an intent and the engine re-syncs. See packages/dom/src/ime/composition.ts.
State
createCompositionState(): CompositionState
startComposition(): CompositionState
endComposition(): CompositionState
CompositionState tracks whether composition is active.
Flow
compositionstart— the substrate enters composition. Keyboard-derived intents are suspended; the browser edits the active span directly.- During composition — the DOM and engine state are briefly out of sync; the engine's DOM assertions are suspended.
compositionend— the substrate reads the final composed text, dispatches atypeTextintent, and hands control back. The renderer re-projects from committed state.
Guarantees
- Determinism — the final intent is indistinguishable from direct insertion of the same string.
- History — one composition produces one history entry.
- Round-trip — after composition, the DOM reflects the model exactly.