Browsers have a feature called autocomplete that suggests commonly used values form input fields when users are filling out forms. But browsers do not know which type of content is expected in a certain input field and may suggest inappropriate content. With these properties, you can tell browsers which type of content you expect in an input field and improve the user experience for your forms. For example, when you expect an email address and you choose the corresponding option for an input field, browsers will only suggest email addresses for that input field.
On a technical level, this feature uses the HTML attribute autocomplete. Some useful links:
- Possible values for the autocomplete attribute at MDN Web Docs
- W3C specification for the autocomplete attribute
- WCAG 2 Test Rules for the autocomplete attribute
Name | Description |
---|---|
Value | The expected content type for the input field. When set, browsers will try and suggest only appropriate values. |
Category | The available options depend on the selected value. You can use the category to further restrict the content type. For example, for email addresses, you can restrict the allowed email addresses to private or business addresses. |
Section | Optional. When set, the autocomplete attributs is prefixed with a section-* value. This is useful, for example, when your form contains multiple different addresses. An address usually consists of several input fields, such as an input field for the country, for the ZIP code or for the street name. When you assign all fields that belong to the address 1 to the section one, and all fields belonging to the address 2 to the section two, browsers can distinguish between the two different addresses and autofill only the section for which the user selected an address. |
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article