WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: role="alert" and display:none

for

From: Patrick H. Lauke
Date: Oct 8, 2022 9:41AM


On 06/10/2022 10:08, Patrick H. Lauke wrote:
> On 06/10/2022 01:37, Maia Miller wrote:
[...]
>> According to MDN docs*, we can hide this <div> using display:none, then
>> changing the display to block will read out the alert. My question is:
>> how is this happening? My understanding is that screen readers ignore
>> display:none as it essentially removes the element from the document.
>> But a live region that appears on load with display:none still gets
>> recognized by AT?
>
> That MDN page is wrong/inaccurate. While in some instances flipping the
> display:none/display:block value on the container with role="alert"
> *may* work, it's inconsistent (and seems to rely mostly on internal
> timings of the browser).

Closing the loop, I've just submitted an almost complete rewrite of the
incorrect MDN page about role="alert" here
https://github.com/mdn/content/pull/21395

P
--
Patrick H. Lauke

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