I have some dynamic text "n results found" when you search for something in my application. And I have aria-atomic="true"
and aria-live="assertive"
on this element as follows:
<p aria-atomic="true" aria-live="assertive">n results found</p>
On Mac's voiceover, the message is uttered out correctly without any issues. But on Windows with JAWS software, the message is not uttered out. I noticed that if I turn off the virtual cursor by using the shortcut "Insert+Z", the aria-live
string is uttered out properly.
I don't want the user to hit Insert + Z
to make this work. Is there a way to disable the virtual cursor programmatically? Or is there any other way around this issue?
I tried several other combinations such as using role="status"
, role="alert"
with aria-live="polite"
, aria-atomic="true"
. All of these work on Mac's voiceover and when the virtual cursor is disable on windows with JAWS.
Turns out JAWS has some pretty uptight attribute rules for this work. I finally made this working with either of these following attributes:
<p aria-live="assertive">n results found</p>
<p aria-live="polite">n results found</p>
The following combinations did not work with JAWS without turning off the virtual cursor:
1. role="alert" aria-live="assertive"
2. role="alert" aria-live="assertive" aria-atomic="true"
3. aria-live="assertive" aria-atomic="true"
4. role="status" aria-live="assertive" aria-atomic="true"
5. role="status" aria-live="polite"
6. role="status" aria-live="assertive"
7. role="status" aria-live="polite" aria-atomic="true"
I know that role="alert"
with aria-live="assertive"
is redundant as aria-live="assertive"
implicitly adds the role alert when used. But I did try it out as an experiment, hence mentioned it above.
All the above did work fine on Mac's voiceover.