Phenomenon
When composing Hindi text with Devanagari IME in a contenteditable element, pasting content (Ctrl+V) cancels the active composition and loses the composed text including vowel signs and conjuncts. The pasted content may also be inserted in an unexpected position.
Reproduction example
- Focus the editable area.
- Activate Hindi IME with Devanagari script.
- Start composing Hindi text with vowel signs and conjuncts (e.g., “नमस्ते”).
- Press Ctrl+V to paste content before completing composition.
Observed behavior
- The compositionend event fires with incomplete data
- The composed text including combining characters is lost
- Pasted content is inserted, possibly in wrong position
- The sequence of
paste,compositionend, andinputevents may be inconsistent
Expected behavior
- Composition should complete before paste occurs, or paste should be queued
- All combining characters should be preserved
- Pasted content should be inserted in the correct position
- Event sequence should be predictable and consistent
Browser Comparison
- Chrome: Paste may cancel composition
- Edge: Similar to Chrome
- Firefox: May have different paste behavior during composition
- Safari: Not applicable on Windows
Notes and possible direction for workarounds
- Prevent paste during active composition
- Wait for composition to complete, then allow paste
- Handle paste events carefully during composition, especially with complex character combinations