WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Role=alert > error messages in forms

for

From: Lovely, Brian
Date: Nov 21, 2017 6:52AM


Role="alert" only reacts to change. If you have it on an empty div, and change the content of that div by injecting a text string, it will alert. However, if the contents of the div do not change, it will not alert again.

This is why I prefer using aria-describedby for form errors. Each error container has a unique ID, and each associated input has aria-describedby set to a space-delimited list of IDs. Ideally, when the user attempts to submit the form, the developer has coded it to place focus on the first (in code order) in-error input. Then the user can tab from input to input searching for errors, and the error message(s) will announce each time an in-error input receives focus. Even if focus isn't handled on submit, the user can still tab through the form listening for errors.

-----Original Message-----
From: WebAIM-Forum [mailto: <EMAIL REMOVED> ] On Behalf Of Fernand van Olphen
Sent: Tuesday, November 21, 2017 7:45 AM
To: ' <EMAIL REMOVED> ' < <EMAIL REMOVED> >
Subject: [WebAIM] Role=alert > error messages in forms

Hi everyone,

I have a question about role=alert and error messages.


- Go to: https://www.denhaag.nl/nl/formulier/aanmelden-nieuwsbrief-1.htm

- Try to Submit the form ("Aanmelden") , leaving all fields blank

- The error messages for the required fields are announced in NVDA. (The error messages have a role=alert)

- Submit the form again

- The error messages are NOT announced again.

Does anyone know why the error messages are only mentioned once, and how to fix this?

Because this example works just fine: https://www.w3.org/WAI/WCAG20/Techniques/working-examples/ARIA19/aria-alert-validation.html

- Role=alert is also used for the error messages

- Submitting the form keeps announcing the error messages,
Regards,

Fernand van Olphen
Accessibility Advisor
Municipality of The Hague

De disclaimer van toepassing op e-mail van de gemeente Den Haag vindt u op: http://www.denhaag.nl/disclaimer The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.