WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Temporary error alerts

for

From: Patrick H. Lauke
Date: Sep 28, 2018 10:09AM


On 28/09/2018 16:51, Isabel Holdsworth wrote:
> It used to be that hiding the error container with display="none" when
> not needed and making it visible again when required didn't work with
> all screenreaders. Is this still the case?

It's all a question of timing. Generally, you want a browser/AT to "see"
the container first, and then it will look out for any content changes
and announce them. If you have a fully formed (already filled-in)
container that suddenly "reappears" in the a11y tree, or is inserted
into the page dynamically, it's usually not announced because the
browser/AT didn't have enough time to note the container and watch it
for changes.

This *can* vary in different browser/AT combinations, but it's likely
more to do with microsecond-level timings...and you basically don't want
to rely on that. Best way: hide it not with display:none, but some other
"visually hidden, but accessible" class/method. Or, flip it from
display:none to display:block, wait half a second or so, and THEN insert
the content for the alert/warning.

I referred to this as needing have the container "primed" in my recent
additions to
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions

> And is aria-live="assertive" still preferable to role="alert"?

For best results, use both (to account for older browser/AT combos).

I'll also note that alerts/notifications that automatically disappear
CAN still be a problem for certain users (e.g. sighted users with
cognitive issues, or users that use screen magnification but without
screen reader functionality)

P
--
Patrick H. Lauke

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