coderef

EditContextLimited availability

The EditContext API allows you to build rich text editors that support advanced text input, such as Input Method Editor (IME) composition, an emoji picker, or other platform-specific editing UI.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–120Not supported
121+Supportedsince Jan 23, 2024
Current: 155
Edge
12–120Not supported
121+Supportedsince Jan 25, 2024
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
18–120Not supported
121+Supportedsince Jan 23, 2024
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Firefox, Safari, Firefox Android, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: CharacterBoundsUpdateEvent.

Feature detection

JS · check before using
if ("EditContext" in globalThis) {
  // EditContext is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (39). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
CharacterBoundsUpdateEvent121121✕✕121✕✕
CharacterBoundsUpdateEvent.CharacterBoundsUpdateEvent121121✕✕121✕✕
CharacterBoundsUpdateEvent.rangeEnd121121✕✕121✕✕
CharacterBoundsUpdateEvent.rangeStart121121✕✕121✕✕
EditContext121121✕✕121✕✕
EditContext.EditContext121121✕✕121✕✕
EditContext.attachedElements121121✕✕121✕✕
EditContext.characterBounds121121✕✕121✕✕
EditContext.characterBoundsRangeStart121121✕✕121✕✕
EditContext.characterboundsupdate_event121121✕✕121✕✕
EditContext.compositionend_event121121✕✕121✕✕
EditContext.compositionstart_event121121✕✕121✕✕
EditContext.selectionEnd121121✕✕121✕✕
EditContext.selectionStart121121✕✕121✕✕
EditContext.text121121✕✕121✕✕
EditContext.textformatupdate_event121121✕✕121✕✕
EditContext.textupdate_event121121✕✕121✕✕
EditContext.updateCharacterBounds121121✕✕121✕✕
EditContext.updateControlBounds121121✕✕121✕✕
EditContext.updateSelection121121✕✕121✕✕
Show 19 more
Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
EditContext.updateSelectionBounds121121✕✕121✕✕
EditContext.updateText121121✕✕121✕✕
HTMLElement.editContext121121✕✕121✕✕
TextFormat121121✕✕121✕✕
TextFormat.TextFormat121121✕✕121✕✕
TextFormat.rangeEnd121121✕✕121✕✕
TextFormat.rangeStart121121✕✕121✕✕
TextFormat.underlineStyle121121✕✕121✕✕
TextFormat.underlineThickness121121✕✕121✕✕
TextFormatUpdateEvent121121✕✕121✕✕
TextFormatUpdateEvent.TextFormatUpdateEvent121121✕✕121✕✕
TextFormatUpdateEvent.getTextFormats121121✕✕121✕✕
TextUpdateEvent121121✕✕121✕✕
TextUpdateEvent.TextUpdateEvent121121✕✕121✕✕
TextUpdateEvent.selectionEnd121121✕✕121✕✕
TextUpdateEvent.selectionStart121121✕✕121✕✕
TextUpdateEvent.text121121✕✕121✕✕
TextUpdateEvent.updateRangeEnd121121✕✕121✕✕
TextUpdateEvent.updateRangeStart121121✕✕121✕✕