WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: required field not being announced in Firefox/NVDA

for

From: Birkir R. Gunnarsson
Date: Oct 13, 2017 12:16PM


So based on a very quick test I think I understand what's happening
(or I have a theory).

The error messages when required fields are left blank are implemented
as alerts in Firefox (the equivalent of putting role="alert" on the
error message).
Therefore, when the message is displayed, NVDA follows the rule and
disrupts its reading of anything else on the page to announce the
alert.
In this case it is trying to read the label for the field that
received focus, but the alert overrides it.
If you copy and paste the HTMl below, save it and open it with Firefox
and NVDA, then try to submit the form leaving either field blani, you
notice that NVDA will start saying "use" (as in "username") but
stopsafter the first sound or two to read the error message (it
announces it as "alert").
Same with password, NVDA will say "pa" and then start reading the alert.

There are two possible sources of trouble here.
1. At the browser level, error messages should not be communicated as
alerts, but as polite live regions (they should be read, but after
reading other content).
NVDA, don't let lerts override the reading of form field labels.
Form field labels are usually short and should have priority over
anything else when they are announced.
----
<!DOCTYPE html>
<html lang="en">
<head><title>Testing HTML5 custom validation messages</title></head>
<body>
<h1>Testing HTML5 custom validation messages</h1>
<form>
<label for="un">User name</label>
<input id="un" type="text" required
oninvalid="setCustomValidity('Username required')"
oninput="setCustomValidity('')">
<label for="pwd">Password</label>
<input id="pwd" type="password" required
oninvalid="setCustomValidity('You need to provide a password
silly!!')" oninput="setCustomValidity('')" >
<button type="submit">Submit</button>
</form>
</body>
</html>



On 10/13/17, Beranek, Nicholas via WebAIM-Forum
< <EMAIL REMOVED> > wrote:
> Hi Angela, can you show us the code in context? There's no reason for NVDA
> and Firefox not to honor aria-required and the HTML5 required attribute.
>
> Nick Beranek
> Capital One
>
> On 10/12/17, 8:01 PM, "WebAIM-Forum on behalf of Angela French"
> < <EMAIL REMOVED> on behalf of <EMAIL REMOVED> >
> wrote:
>
> I have tried the following and none of them read the label of the
> required field after alerting the user to please fill in the require field.
> aria-required="true"
> required
> required=""
> required="true"
>
> I give up.
>
> Angela
>
>
>