uswds / uswds-site

USWDS website and documentation
https://designsystem.digital.gov
Other
183 stars 140 forks source link

USWDS-Site - Guidance: Combo box autocomplete guidance to consider input or select #2711

Open mahoneycm opened 2 weeks ago

mahoneycm commented 2 weeks ago

Summary

Found when discussing accessibility checklists with @amycole501

Input and select components can use autocomplete to store and fill user data. The list of token values is limited and exclusive to personal data.

Combobox dynamically sets auto-complete to off.

Proposed solution

Add guidance to "When to consider something else" to use input or select when autocomplete is desired.

Autocomplete. Use an input or select component when autocomplete is desired.

Alternative solutions

We discussed adding a feature to combo box to allow users to set autocomplete, but the appropriate use cases seem like rare, edge cases. The input for the specified tokens is often unique and would not be presented in a drop-down list (credit card number, street address, email address). Others are smaller lists that wouldn't necessitate a combo box (pronouns, prefix/suffix). You could use combobox for user Country (there is no state autofill in the list) or birth month, but you should only use these autocomplete fields for personal data, not a general pick a month / country respectively.

References

MDN Docs - HTML attribute: autocomplete W3C - Using HTML 5.2 autocomplete attributes