There are ten gazillion threads on here re. how to disable browser autocomplete behavior, e.g. How do you disable browser Autocomplete on web form field / input tag?. I do not want to set autocomplete="off"
for my form fields. As the MDN documentation for how to do that states:
It is important to know that if you turn off autocomplete, you are breaking [WCAG rule 1.3.5]
So as an alternative to disabling autocomplete, I want to understand whether as a developer I can help the browser make its suggestions for my form fields more relevant.
As it is, I can see why many developers (or their bosses/clients) do end up wanting to be rid of the feature entirely. For example, when I added an <input name="title">
to a completely unrelated website I was developing locally, my browser suddenly started offering me a random sampling of questions I'd asked/edited across several StackExchange sites over several years:
How can I help the browser improve the user experience here? What factors do browsers use when choosing what text to suggest?
- clearly the domain is not taken into consideration, unless my testing via
localhost
is triggering more promiscuous autocomplete than normal? - apparently at least one browser considers the field's
name
attribute to have universal semantic meaning, since Chrome is suggesting content I typed into other sites which happened to also usename="title"
within their forms. - does any metadata on the form itself affect the suggestions? E.g. if I wrapped this input in a
<form id="my-particular-form-has-nothing-to-do-with-qa-sites-btw">
might some browsers scope their autocomplete to only suggest previousname="title"
entries intomy-particular-form…
?
Again, I am not looking for answers that tell me how to disable autocomplete or complaints that this is a duplicate of questions asking how to do that. I am happy to let the browser help the user fill in my form fields, but I want to help that help be more…helpful.
(Or, do I misunderstand the purpose of autocomplete
to begin with? Is it only intended to be used for use cases like login credentials, shipping addresses, credit card number, etc. and I should be using autocomplete="off"
for everything else?)