WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: Error alert and edit field focus

for

Number of posts in this thread: 2 (In chronological order)

From: barry.hill3@sky.com
Date: Thu, Jun 11 2020 8:17AM
Subject: Error alert and edit field focus
No previous message | Next message →

Hi all



When a form is submitted with an error, is it possible to set the focus into
the problem edit field and to have the screen reader read the error message
using aria?



Thanks in anticipation.



Cheers



Barry

From: Jared Smith
Date: Thu, Jun 11 2020 8:33AM
Subject: Re: Error alert and edit field focus
← Previous message | No next message

Yes, give the field aria-invalid="true" and aria-describedby that
references the descriptive error message, then set focus to the field
with JavaScript.

The potential difficulty with this approach is that if there are
multiple errors the user may not be aware of these unless they
subsequently navigate to them.

Jared