I have an aria-live region on a role="alert" with the value "assertive" that is not being spoken on form submit. It is being written, by PHP, at that time too, which is like page load.
It works fine in NVDA on a PC, but nothing is spoken on a Mac. I swear I have tested this before and have used this technique frequently.
Any ideas why it is not being spoken?
The div looks like this:
<div class="alert alert-danger" role="alert" aria-live="assertive">Error: please fix the indicated fields:</div>
Directly reading ARIA live regions at page load is known to not work, or not always reliably with certain combinations of screen readers + browsers. This is a fact: you can't do anything about it.
ARIA live regions are read when a new live region is added to the DOM or when the text content of an existing live region is updated. This works for almost all combinations of screen readers + browser. However, nothing is clearly specified for live reagions that exists at page load, if they have to be read or not; so, it depends on the screen reader and the browser.
Knowing this, you can trigger the read by doing one of the two things mentionned above, shortly after the page is loaded:
Note that it won't work if you add/change role and/or aria-live attributes of an existing element. The element has to be new or its text has to effectively change.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With