可以使用什么Aria-Label?
ARIA-LABEL
到底可以使用什么?
我发现文档显示可以在交互式项目上使用(例如< button>
),但是可以在以下任何一个上使用:
< p>
,< span>
,< li>
或< abbr< abbr>
?
我试图在段落中具有特定的单词和缩写,读出是特定的(例如:澳大利亚人读为“ ozzies”,而不是“ ossies”或“ ossies”或“ nsw”,读出Microsofoft
Edge的测试 ) ,Google Chrome,Mozilla Firefox(所有Windows 10)和iPhone Safari(ios)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通常,您不应在静态内容上使用
aria-label
。它仅用于交互式元素和一些分段元素。请记住,上述指南是在2018年撰写的,一些浏览器的支持可能有所改善,但是上面的建议仍然很安全,我建议主要遵循它。
感谢Brennanyoung在史蒂夫·福克纳(Steve Faulkner)的这篇文章中传递了这篇文章:
https://html5accessibility.com/stuff/2020/11/07/not-so-so-short-note-note-on-aria-rabel-usage-usage-big-table-edition/
值得一提的是,上述测试结果是比W3C在我的帖子开头给出的建议更新,它确实与某些地方的W3C建议相矛盾。
附加资源:
You should generally not use
aria-label
on static content. It's only intended to be used on interactive elements and some sectioning elements.https://www.w3.org/TR/using-aria/#practical-support-aria-label-aria-labelledby-and-aria-describedby
Keep in mind that the above guidance was written in 2018, and support has likely improved among some browsers, but the advice above is still safe, and I would recommend mostly following it.
Thanks to brennanyoung for passing along this great article from Steve Faulkner:
https://html5accessibility.com/stuff/2020/11/07/not-so-short-note-on-aria-label-usage-big-table-edition/
It's worth mentioning that the above test results are more recent than the advice given by W3C at the beginning of my post, and it does contradict the W3C advice in some places.
Additional Resources:
属性ARIA-LABEL和ARIA-LABELLED通常仅在交互元素上正确识别并正确识别,例如按钮,表单字段,链接等。
当它们用于非相互作用元素时,例如
< p>,< div>,< li>
时,它们通常不起作用,即不读或显示。您可以在
< p>,lelt; li>
上使用aria-label或aria-labelledby,但是只有在互动时才起作用。交互式的定义非常简单:这意味着您可以与之互动。从技术上讲,这基本上意味着集中。
请注意,在一些浏览器和/或屏幕读取器的情况下,Aria-label上的元素自然要焦点的元素只有在形式模式下导航而不以浏览模式进行导航时才能起作用。
通过自然焦点,我的意思是不需要明确的Tabindex进行互动的要素。
元素
< abbr>
是一种特殊情况。扩展的含义必须存在于标题属性中,而不是ARIA-LABEL中。Attributes aria-label and aria-labelledby are typically used and correctly recognized only on interactive elements such a buttons, form fields, links, etc.
They usually don't work, i.e. not read or shown, when they are used on non-interactive elements such as
<p>, <div>, <li>
.You can use aria-label or aria-labelledby on a
<p>, <li>
, but it will work only if it's interactive.The definition of interactive is quite simple: it means something you can interact with. More technically, it basically means focusable.
Note that with some browsers and/or screen readers, aria-label on elements that aren't naturally focusable may only work when navigating in form mode but not in browse mode.
BY naturally focusable, I mean elements that don't need an explicit tabindex to be interactive.
The element
<abbr>
is a special case. The expanded meaning must be present in the title attribute and not aria-label.这很可能是帮助残疾人和老年人的属性。 (例如屏幕读取器)将标签附加到原本匿名的HTML元素上。
通常,搜索输入字段没有视觉标签(感谢设计师)。 ARIA-LABEL可用于将控件标签传达给屏幕读取器用户。
当用户专注于两个按钮(通过按住选项卡)(通过区域标签)(您可以听到专注于第一个X按钮)时,只会告诉您x按钮,但如果使用第二个X按钮。
我希望它有帮助。
您可以在此处阅读更多信息 https://www.aditus.io/aria/aria/aria-laia-laia-label /
It's most likely an attribute to help people with disabilities and the elderly. (e.g. screen readers) attach a label to an otherwise anonymous HTML element.
Usually search input field does not have visual label (thanks to designers). aria-label can be used to communicate the label of control to screen reader users.
When user focus on both button(by pressing tab) with area label — you can hear focusing on first x button — will tell you only x button but in case of second x button .. you will hear back to the page button only..
i hope it helps.
you can read further information here https://www.aditus.io/aria/aria-label/