简体   繁体   中英

NVDA isn't reading multiple aria-live tags on single web page.

I am using multiple aria-live tags on a webpage, and when an error is shown on webpage NVDA only reads the first error message and not all. I have user aria-live="assertive" also have also tried with aria-live="polite" but not working, can anyone provide some solution for it. below is my code:

<div>
        <input type="text" name="username" tabIndex="0"/>
        <span class="usernameerr" role="alert" aria-live="assertive">Enter User Name</span>
    </div>
    <div>
        <input type="passowrd" name="password" tabIndex="0"/>
        <span class="passworderr" role="alert" aria-live="assertive">Enter Password</span>
    </div>
    <div>
        <input type="text" name="repassword" tabIndex="0"/>
        <span class="repassworderr" role="alert" aria-live="assertive">Renter Password</span>
    </div>
    <div>
        <input type="submit" tabIndex="0"/>
    </div>

Help will be appreciated.

If you have role=alert , that implies aria-live=assertive . When you have aria-live=assertive , a screen reader might clear the queue of pending messages. So if you have three assertive areas, they might step on each other and clear the other messages. The last one probably wins.

See https://www.w3.org/TR/wai-aria-1.1/#aria-live . It says "User agents or assistive technologies MAY choose to clear queued changes when an assertive change occurs."

So you might hear the problem with one screen reader and not another. You can test it out by removing role=alert and changing aria-live to polite . (You said you tried it with aria-live=polite but if you didn't remove the alert role, then it still would have been assertive .)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM