Since June 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
The type property of the Highlight interface is an enumerated String used to specify the meaning of the highlight. This allows assistive technologies, such as screen readers, to include this meaning when exposing the highlight to users.
By default, a highlight object will have its type set to highlight, but you can change it to spelling-error or grammar-error.
The possible values of the type enumerated value are:
highlightThis is the default highlight type. It does not have any specific meaning.
spelling-errorUse this type when the highlight is used to emphasize misspelled content.
grammar-errorUse this type when the highlight is used to emphasize content that is grammatically incorrect.
const spellErrorRange = new Range(); spellErrorRange.setStart(textNode, 10); spellErrorRange.setEnd(textNode, 20); const spellErrorsHighlight = new Highlight(spellErrorRange); spellErrorsHighlight.type = "spelling-error";
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
type |
105 | 105 | 140 | 91 | 17.2 | 105 | 140 | 72 | 17.2 | 20.0 | 105 | 17.2 |
© 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/Highlight/type