Fields that collect a person's own details should say what they are for, using autocomplete tokens, so autofill and assistive tools can help.
An enrollment, benefits or utility form asks for the same few things again and again: name, address, phone, email, card details. For someone with a tremor, a memory difficulty or dyslexia, each field typed by hand is a place to make an error or give up. Browsers and assistive tools can fill these in, and some can show a familiar icon beside the field, but only if the field says what it is for.
WCAG 1.3.5 (Level AA) requires that the purpose of each input field collecting information about the user can be programmatically determined, when the field serves one of the purposes in WCAG's list of input purposes and the technology supports it. On the web this is the autocomplete attribute, whose values are fixed and independent of language.
type: type="email" does not tell whether the address is the user's or another person's, so it is too broad on its own.Whether a browser actually autofills does not decide conformance; what matters is that the purpose is exposed. Autofill can still be turned off for a form while each field keeps its token.
The forms that residents complete most often are also the longest: school district enrollment, benefits renewal, utility bill payment, library card applications. They repeat the same personal details, and they are often completed on a phone with a keyboard that is hard to use. DOJ's list of common barriers includes inaccessible forms; marking the purpose of fields is a low-cost way to make them easier for people who rely on autofill or on tools that add icons and clearer labels. See common barriers for other recurring form problems.
Use the token that names the data, on the field that collects it.
<label for="fn">Parent or guardian first name</label>
<input id="fn" name="fn" type="text">
<label for="em">Email</label>
<input id="em" name="em" type="email">
<label for="zip">ZIP code</label>
<input id="zip" name="zip" type="text"><label for="fn">Parent or guardian first name</label>
<input id="fn" name="fn" type="text" autocomplete="given-name">
<label for="em">Email</label>
<input id="em" name="em" type="email" autocomplete="email">
<label for="zip">ZIP code</label>
<input id="zip" name="zip" type="text" autocomplete="postal-code">Sign-in forms have their own tokens, which also help password managers.
<label for="acct">Account number or email</label>
<input id="acct" name="acct" type="text">
<label for="pw">Password</label>
<input id="pw" name="pw" type="password"><label for="acct">Account number or email</label>
<input id="acct" name="acct" type="text" autocomplete="username">
<label for="pw">Password</label>
<input id="pw" name="pw" type="password" autocomplete="current-password">Payment details have a dedicated set of tokens.
<input name="holder" aria-label="Name on card">
<input name="card" aria-label="Card number" inputmode="numeric">
<input name="exp" aria-label="Expiry date"><input name="holder" aria-label="Name on card" autocomplete="cc-name">
<input name="card" aria-label="Card number" inputmode="numeric"
autocomplete="cc-number">
<input name="exp" aria-label="Expiry date" autocomplete="cc-exp">Native toolkits expose the same idea as content types or autofill hints.
TextField("Email", text: $email)
.keyboardType(.emailAddress)TextField("Email", text: $email)
.keyboardType(.emailAddress)
.textContentType(.emailAddress)OutlinedTextField(
value = email,
onValueChange = { email = it },
label = { Text("Email") }
)OutlinedTextField(
value = email,
onValueChange = { email = it },
label = { Text("Email") },
modifier = Modifier.semantics {
contentType = ContentType.EmailAddress
}
)autocomplete value. Compare it with the list of tokens in the HTML specification.Automated tools can validate token values and flag missing ones; whether a field truly collects the user's data is a judgement a person makes.
autocomplete="fname".autocomplete="off" on fields that should name their purpose.email on the field for someone else's email.div and exposes no purpose.autocomplete token.