Autocomplete Valid
Serious - WCAG Level AA
The issue with the 'autocomplete-valid' rule arises when form fields have incorrect or missing 'autocomplete' attributes. This attribute is essential for enhancing user experience by providing users with relevant suggestions based on their previous inputs. This is particularly beneficial for users with disabilities, such as those with motor impairments who may find typing difficult, as it reduces the need for repetitive data entry.
To fix this issue:
Ensure that each form field has a valid and appropriate 'autocomplete' attribute value. The attribute should match the type of data the field is collecting. For example, use 'autocomplete="email"' for email fields, 'autocomplete="tel"' for telephone numbers, and 'autocomplete="address-line1"' for street addresses.
Refer to the HTML Living Standard for a comprehensive list of valid autocomplete tokens.
Best practices:Use specific tokens for each field to improve accuracy and consistency. For instance, instead of using 'autocomplete="on"', use 'autocomplete="given-name"' or 'autocomplete="family-name"' for name fields. This specificity helps browsers provide more precise suggestions.
Common mistakes:Use generic or incorrect tokens, such as 'autocomplete="off"', which disables the feature, or using values that do not correspond to the field's purpose. Avoid these errors to ensure users benefit from the autocomplete functionality
By adhering to these guidelines, you ensure that your forms are accessible, user-friendly, and compliant with WCAG 2.1 standards, specifically under Success Criterion 4.1.2, which focuses on ensuring that user interface components have correct names, roles, and values.