如何停止 NVDA 读出数组中存在的 HTML 元素的列表编号(1 of 2)
我正在使用 NVDA 屏幕阅读器进行辅助功能测试。同样,我有 2 个按钮/链接,它们是上下文菜单的一部分,因此存在于数组中,如“提交”和“删除”。现在其中一个按钮有 aria-label="Submit Button"。 NVDA 正在读取“提交按钮 1 of 2”。我只是想确保 NVDA 不会读取 2 中的 1。请提供同样的帮助。
I'm using NVDA screen reader for my accessibility testing. In the same, I have 2 buttons/links which are part of a context menu and thus are present inside an array say "Submit" and "Delete". Now one of the buttons has aria-label="Submit Button". And NVDA is reading "Submit Button 1 of 2". I just want to make sure that NVDA doesn't read 1 of 2. Please help with the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NVDA 对数组或您用于编码的语言一无所知。它所了解的是语义 HTML 元素。因此,如果您的按钮或链接位于列表内(
或
),或者这些按钮本身就是某个组的一部分,例如单选按钮组 (
),那么 NVDA 宣布集合中的项目编号是绝对正确的。
如果您使用 ARIA 属性,例如
aria-setsize
和aria-posinset
,但这些属性并没有被大量使用,所以我猜不是那样的。听到“1 of 2”是屏幕阅读器的一个很棒的功能,它可以让用户了解集合有多大以及它们在集合中的哪个项目。有视力的用户通过眼睛获取这些信息。您不想删除该功能,除非您滥用分组功能并且该按钮实际上并不是组的一部分。
宣布小组立场的不同方式的示例。
使用列表
我可以使用
role="list"
和role="listitem" 而不是使用真正的
并获得相同类型的“1 of 2”消息。使用单选按钮
使用 ARIA 集
请注意,不同的屏幕阅读器可能以不同的方式播报一组内容。有些人会说“1 of 2”,有些人可能只是说这是一个组(没有数字)。它还取决于您如何导航到按钮,是通过 TAB 还是通过向上/向下箭头键来遍历 DOM。
但这里的教训是,如果您有一组事物并且编码正确,那么您希望屏幕阅读器宣布组信息。如果您的按钮实际上并不是组的一部分,但您仍然听到组信息,那么您的代码中存在错误。如果您可以发布一些代码,可能会有所帮助。
NVDA doesn't know anything about arrays or the language you're using to code in. What it does know about is semantic HTML elements. So if you have your buttons or links inside of a list (
<ul>
or<ol>
) or if the buttons are natively part of a group such as a radio button group (<input type="radio" name="groupName">
), then it's absolutely correct for NVDA to announce the item number within the set.You can also get "1 of 2" announced if you're using ARIA attributes such as
aria-setsize
andaria-posinset
, but those attributes aren't heavily used so I'm guessing it's not that.Hearing "1 of 2" is a fantastic feature of screen readers to give the user an idea of how big a set is and which item they're on in the set. Sighted users get that information with their eyes. You don't want to take that feature away unless you are misusing a grouping feature and the button isn't really part of a group.
Examples of different ways to get the group position announced.
Using lists
Instead of using a real
<ul>
, I could userole="list"
androle="listitem"
and get the same type of "1 of 2" messages.Using radio buttons
Using ARIA sets
Note that different screen readers may announce groups of things differently. Some will say "1 of 2", some might just say it's a group (without the number). It also depends how you navigate to the button, whether via TAB or the up/down arrow keys to walk the DOM.
But the lesson here is that if you have a group of things and it's properly coded, then you want the screen reader to announce the group info. If your buttons are not really part of a group but you're still hearing group info, then you have a bug in your code. It may help if you can post some of your code.