Re: Required input. HTML attribute and plain "required" text in label results in duplication for AT. Hide one?

> but removing a valuable item of meta information that describes the input
to machines (a secondary but important aim) feels like a different failure
to fix the first

That isn't a failure in itself, so long as the hidden text is announcing
it, which it is. To see this, consider what AT does with the information
from the required attribute - all it does is announce "required" to the
user when they land on the field. There is no other, more mysterious effect
on AT. So Adam is quite right, if you take away the HTML required attribute
and leave the hidden text for screen readers in the label, it will always
be announced with the label when the user lands on the field! The WCAG does
not say how you should pass the info to AT by the attribute, only that you
must do it some way.

Additionally, there is an actual problem with using the HTML required
attribute. When keyboard users and AT users are just going through the
form  to find out what's there, in discovery, they tab onto the field then
onto the next one - and at that point browser validation in some browsers
automatically shows an error message saying you must complete the field!
Keyboard and screen reader users don't want that when they are only in
discovery mode. It's annoying for them (much more than a repetition of
"required"), and also a WCAG fail of 4.1.2 because it's reporting an error
where none exits - the user hasn't started completing the form yet so how
can there be errors? So if you were going to use the required attribute,
use the ARIA one, aria-required, not the HTML one to avoid that.

Received on Tuesday, 30 August 2022 21:20:20 UTC