简体   繁体   English

NVDA不在单个网页上读取多个aria-live标签。

[英]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. 我在网页上使用多个aria-live标签,并且当网页上显示错误时,NVDA仅读取第一个错误消息,而不是全部。 I have user aria-live="assertive" also have also tried with aria-live="polite" but not working, can anyone provide some solution for it. 我的用户aria-live =“ assertive”也尝试过aria-live =“ polite”,但无法正常工作,谁能为它提供一些解决方案。 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 . 如果您具有role=alert ,则意味着aria-live=assertive When you have aria-live=assertive , a screen reader might clear the queue of pending messages. 当您具有aria-live=assertive ,屏幕阅读器可能会清除挂起的消息队列。 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 . 参见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 . 您可以通过删除role=alert 并将 aria-live更改为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 .) (您说过您尝试使用aria-live=polite尝试,但是如果您不删除alert角色,那么它仍然会是assertive 。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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