This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The DOM CompositionEvent represents events that occur due to the user indirectly entering text.
CompositionEvent()Creates a new CompositionEvent object instance.
This interface also inherits properties of its parent, UIEvent, and its ancestor — Event.
CompositionEvent.data Read only
Returns the characters generated by the input method that raised the event; its varies depending on the type of event that generated the CompositionEvent object.
CompositionEvent.locale Read only Deprecated Non-standard
Returns the locale of the current input method (for example, the keyboard layout locale if the composition is associated with an Input method editor).
This interface also inherits methods of its parent, UIEvent, and its ancestor — Event.
CompositionEvent.initCompositionEvent() Deprecated
Initializes the attributes of a CompositionEvent object.
| Specification |
|---|
| UI Events> # interface-compositionevent> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
CompositionEvent |
26 | 12 | 53 | 15 | 7 | 26 | 53 | 14 | 7 | 1.5 | 4.4 | 7 |
CompositionEvent |
15 | 12 | 9 | 15 | 5 | 18 | 9 | 14 | 5 | 1.0 | 4.4 | 5 |
data |
15 | 12 | 9 | 15 | 5 | 18 | 9 | 14 | 5 | 1.0 | 4.4 | 5 |
initCompositionEvent |
15 | 12 | 9 | 15 | 5 | 18 | 9 | 14 | 5 | 1.5 | 4.4 | 5 |
locale |
No | 12–79 | 9–143 | No | No | No | 9–143 | No | No | No | No | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent