v152 · html · forms · javascript
Expose the autocorrect global HTML attribute
Chrome 152 exposes autocorrect as a reflected JavaScript property on HTMLElement, making it read/write from script just like autocomplete or spellcheck. Firefox and Safari already ship this.
at a glance
| Shipped in | Chrome 152 (Enabled by default) |
|---|---|
| Status | Enabled by default |
| Spec | HTML Living Standard §Autocorrection |
| Standards position (Firefox) | Shipped/Shipping |
| Standards position (Safari) | Shipped/Shipping |
| ChromeStatus | 6264645053710336 — Expose the autocorrect global HTML attribute |
why it exists
The HTML autocorrect content attribute has existed in browsers for years, but Chrome did not expose it as a JavaScript property on HTMLElement. This meant that code like input.autocorrect = 'off' silently did nothing in Chrome, even though the HTML attribute <input autocorrect="off"> worked. Firefox and Safari already reflected the attribute, so Chrome was the interop outlier.
Chrome 152 adds the IDL attribute, making autocorrect behave like other reflected boolean/string HTML attributes: setting it in JavaScript updates the content attribute and vice versa.
shape of the API
partial interface HTMLElement {
[CEReactions] attribute boolean autocorrect;
};
| Property | Type | Notes |
|---|---|---|
HTMLElement.prototype.autocorrect | boolean | Reflects the autocorrect content attribute. true = on; false = off |
The property is a boolean reflection of the autocorrect content attribute. When reading, it returns true if the used autocorrection state is on and false if off. When writing, assigning true sets the content attribute to "on", and assigning false sets it to "off". Getting or setting the property does not throw runtime exceptions.
example
const input = document.querySelector('input[name="username"]');
// Read the attribute via JS property (Chrome 152+)
console.log(input.autocorrect); // false (attribute says "off")
// Write via JS property
input.autocorrect = false; // adds autocorrect="off"
input.autocorrect = true; // removes the attribute / sets to "on"
// Equivalent HTML
// <input autocorrect="off"> → input.autocorrect === false
// <input> → input.autocorrect === true (default on)
// Dynamic form builder
function buildCodeField(container) {
const ta = document.createElement('textarea');
ta.autocorrect = false; // Chrome 152+, Firefox, Safari
ta.autocapitalize = 'none';
ta.spellcheck = false;
container.append(ta);
return ta;
}
Source: HTML Living Standard §Autocorrection
browser support
| Browser | Support | Notes |
|---|---|---|
| Chrome 152+ | Enabled by default | JS property now reflects the attribute |
| Firefox | Shipped | Already reflected (bug 1927977) |
| Safari | Shipped | Already reflected (Safari 18.2) |
Security and privacy: The autocorrect attribute and property control client-side input editing assistance (such as OS-level spelling correction and IME behavior) on editable elements. Exposing the reflection property does not introduce cross-origin data exposure or access elevated user privileges.
see also
- Chrome Platform Status — Expose the autocorrect global HTML attribute
- ChromeStatus API record 6264645053710336
- HTML Living Standard — Autocorrection
- blink-dev Intent to Ship: Expose the autocorrect global HTML attribute
- Chromium Issue 40871769
- MDN: autocorrect global attribute
- Mozilla Bugzilla 1927977
- WebKit Features in Safari 18.2
- WPT: autocorrection.html
- Chromium html_element.idl