HTML writingsuggestions Attribute
The HTML writingsuggestions global attribute controls whether browser-provided writing suggestions should be offered within an element's scope. These suggestions can help users complete words, phrases, or sentences while entering editable text.
Elements That Use the writingsuggestions Attribute
The writingsuggestions attribute is a global attribute and can be specified on all HTML elements. Its writing-suggestion behavior is relevant to editable content, including supported <input> controls, the <textarea> element, and elements that are editable with the contenteditable attribute.
writingsuggestions Attribute Value
The writingsuggestions attribute is an enumerated attribute with two keywords: true and false.
| Value | Description |
|---|---|
true |
Writing suggestions should be offered within the element's scope when supported and enabled by the user. |
false |
Writing suggestions should not be offered within the element's scope. |
An empty value, such as writingsuggestions="", represents the true state. An invalid value also represents the true state. When the attribute is omitted, the element uses the default behavior, which can depend on an ancestor element's writingsuggestions setting.
The true Value
The true value indicates that the browser should be allowed to provide writing suggestions within the element's scope.
<textarea writingsuggestions="true"></textarea>
When supported, the browser decides how suggestions are presented. For example, suggestions might appear while the user types or be offered through another browser-specific interface.
The false Value
The false value indicates that browser-provided writing suggestions should not be offered within the element's scope.
<textarea writingsuggestions="false"></textarea>
This can be useful when a website provides its own writing assistance or when browser-generated suggestions would interfere with the intended editing experience.
Using writingsuggestions with Editable Content
Writing suggestions are relevant to text-entry controls and editable regions. They can apply to mutable <textarea> elements, supported <input> types, and elements that form part of an editable region.
<input type="text"
writingsuggestions="true">
<textarea writingsuggestions="false"></textarea>
<div contenteditable="true"
writingsuggestions="true">
Edit this text.
</div>
For <input>, writing suggestions are relevant to editable text-entry types such as text, search, tel, url, and email.
Writing Suggestions and Ancestor Elements
The writingsuggestions setting can affect editable content within an element's scope. This allows suggestions to be controlled for a larger section of a document instead of adding the attribute to every editable element individually.
<section writingsuggestions="false">
<label for="notes">Notes:</label>
<textarea id="notes" name="notes"></textarea>
</section>
In this example, the ancestor's writingsuggestions="false" setting prevents browser-provided writing suggestions within its scope. A false setting on the nearest relevant ancestor prevents suggestions from being offered within that scope.
User and Browser Control
The writingsuggestions attribute controls whether a page allows browser-provided writing suggestions, but it does not require a browser to display them. The browser determines how suggestions are presented, and users can disable writing suggestions through their browser or device settings.
Because writing assistance can vary between browsers, operating systems, and user preferences, a page should not depend on writing suggestions for essential functionality.
Common Mistakes
Do not treat writingsuggestions as a boolean attribute. Use the enumerated values true and false. For example, writingsuggestions="false" disables suggestions, while merely including the attribute without a value represents the true state.
Do not assume that writingsuggestions="true" guarantees that suggestions will appear. The browser must support the feature, and the user can disable writing suggestions.
Do not confuse writingsuggestions with spellcheck. Writing suggestions can offer completions or other writing assistance, while spellcheck controls whether spelling and grammar checking is enabled.
Do not rely on writing suggestions for essential form instructions or required information. Their availability and presentation depend on the browser and the user's settings.
Browser Support
Baseline: Limited availability indicates that a feature is not yet available in all core browsers. Use these features with caution because they may only work in select browsers, so additional compatibility checks may be needed before general use.
The writingsuggestions global attribute has limited availability and should not be relied on for essential functionality. Browsers that do not support it can ignore the attribute while editable content continues to function normally.
Checking Browser Support
For current browser compatibility information, visit Can I Use? . Search for the HTML element or attribute you want to check. You can also narrow your search by entering an element name and attribute name separated by a colon. Search results can include related HTML features, element attributes, input types, APIs, and other technologies, so select the result that most closely matches the feature you are checking.
Try the writingsuggestions Attribute
The example provides two textareas. The first allows browser-provided writing suggestions, while the second disables them. The difference will only be visible when the browser supports writing suggestions and the feature is enabled in the user's browser or device settings.
Play in EditorSummary
The HTML writingsuggestions global attribute controls whether browser-provided writing suggestions should be offered within an element's scope. Use true to allow suggestions and false to disable them. The feature applies to editable content, can be affected by ancestor settings, and remains subject to browser support and user preferences.
