WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: SC 1.3.5 and input type=date

for

From: Patrick H. Lauke
Date: Oct 31, 2023 4:55AM


Taking a step back...

<input type="date">

on its own just programmatically identifies this input as being *some
kind of date*. It doesn't say, programmatically, *what* date this may
be. It could be today's date, your birthdate, the date when you want a
contract to start or end, etc.

1.3.5 wants you to be more specific: if the input is indeed your
birthdate, then it needs to programmatically indicate this purpose
somehow. You need to add something extra there, based on a solid and
widely distributed ontology (and this aspect is where 1.3.5 handwaves
things a lot) that tools (such as screen readers) can then use to
understand the explicit purpose of the input. For all intents and
purposes, in HTML, the autocomplete attribute is the only (?) way to add
this extra information (unless there's some reasonably solid RDFa
attribute tuple? I've never looked into this...)

So, you want to have

<input type="date" autocomplete="bday">

Now, for 1.3.5, it's the autocomplete part that matters. The type="date"
bit is, in effect, irrelevant here. The following would be just as valid
for 1.3.5

<input type="text" autocomplete="bday">

Lastly, whether or not the browser autofills a field correctly, with or
without the autocomplete attribute, is also irrelevant. The point of
1.3.5 isn't "does the browser manage to autofill correctly", but "is
there an explicit indication of the purpose of the field".

Browsers do often use heuristics to autofill fields. Can't rely on
heuristics for a pass/fail determination in WCAG.

P
--
Patrick H. Lauke

https://www.splintered.co.uk/ | https://github.com/patrickhlauke
https://flickr.com/photos/redux/ | https://www.deviantart.com/redux
https://mastodon.social/@patrick_h_lauke | skype: patrick_h_lauke