1 year ago

#209493

test-img

tanmayghosh2507

How to set up aria-live="assertive" and role="alert" in a nested structure?

I have a big web page, and in which after a successful submission of a form, it starts showing up a success/failure message, and we want NVDA to automatically read the same as soon as Submit button is clicked. I've tried the basic recommendations to add aria-live and role attributes, but its not working. Here is the snippet:

<p class="mb-hidden" ref={(el) => (this.messageBar = el as HTMLParagraphElement)}>
  <div aria-live="assertive" id ="testID" role="alert">
    <span class="classRed" id="container2" ref={(el) => (this.message = el as HTMLSpanElement)}></span>
  </div>
</p>

The span is getting updated with the message after a Submit button is clicked, but NVDA is not reading the message automatically.

html

accessibility

nvda

aria-live

0 Answers

Your Answer

Accepted video resources