Composition events
The DOM CompositionEvent represents events that occur due to the user indirectly entering text.
Event UIEvent CompositionEvent
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 15 | 12 | 9 | 5 | 18 | 5 | |
| The CompositionEvent() constructor creates a new CompositionEvent object. | 26 | 12 | 53 | 7 | 26 | 7 |
| The data read-only property of the CompositionEvent interface returns the characters generated by the input method that raised the event; its exact nature varies depending on the type of event that generated the CompositionEvent object. | 15 | 12 | 9 | 5 | 18 | 5 |
| The compositionend event is fired when a text composition system such as an input method editor completes or cancels the current composition session. | 15 | 12 | 9 | 5 | 18 | 5 |
| The compositionstart event is fired when a text composition system such as an input method editor starts a new composition session. | 15 | 12 | 9 | 5 | 18 | 5 |
| The compositionupdate event is fired when a new character is received in the context of a text composition session controlled by a text composition system such as an input method editor. | 18 | 12 | 9 | 5 | 18 | 5 |
Use cases
-
Using Composition events
The DOM CompositionEvent represents events that occur due to the user indirectly entering text.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.