添加ARIA标签后,屏幕阅读器无法阅读

发布于 2025-01-26 13:25:34 字数 278 浏览 4 评论 0原文

我添加了Aria-Label,但仍无法阅读第1 div的警告。 重点是第1 div,但不读任何东西。如何告诉屏幕阅读器阅读Waring Icon?

<div aria-label="Warning for" class="col-xs-1 color-red-1 hbmi-warning m-t-2"></div>
<div class="col-xs-10 p-l-1x p-r-unset">Deductible Amount</div>

I have Added aria-label but still Screen Reader not able to read Warning for which is 1st div .
focus goes on 1st div but not reading anything. How to tell screen reader to read warining icon ?

<div aria-label="Warning for" class="col-xs-1 color-red-1 hbmi-warning m-t-2"></div>
<div class="col-xs-10 p-l-1x p-r-unset">Deductible Amount</div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苍白女子 2025-02-02 13:25:34

aria-label主要用于交互式元素,尽管 aria-label 的文档并未具体说明。

该文档讨论了您可以可靠地使用它的元素, https://www.w3.org/tr/usish-ria/#practical-support-aria-aria-aria-rabel-aria-aria-labelle-labelledby-and-aria-descriped 。第三个子弹点说:

  • 不要在spandiv上使用aria-label或aria-labelledby。

我不会在&lt; div&gt;上随机将角色,尤其是alert之类的东西。

您要实现什么行为?
div错误图标吗?
您是否希望屏幕读取器用户找到此div?这不是交互元素。

aria-label is mainly to be used on interactive elements, although the doc for aria-label doesn't specifically say that.

This doc talks about elements you can reliably use it on, https://www.w3.org/TR/using-aria/#practical-support-aria-label-aria-labelledby-and-aria-describedby. The third last bullet point says:

  • Don't use aria-label or aria-labelledby on a span or div unless its given a role.

I would not randomly throw a role on the <div>, especially something like alert.

What behavior are you trying to achieve?
Is the div an error icon?
Do you want screen reader users to find this div? It's not an interactive element.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文