admin管理员组文章数量:1391943
I have given a specific aria-label for <p>
tag in my web page.
<p aria-label="my custom text" className="inline">text</p>
The aria-label given on this is reading perfectly fine on Mac screen reader, but it is not happening on JAWS ( on windows ). Is there any specific settings / extra tags has to be added in order to read the same in JAWS ? Any thoughts ?
I have given a specific aria-label for <p>
tag in my web page.
<p aria-label="my custom text" className="inline">text</p>
The aria-label given on this is reading perfectly fine on Mac screen reader, but it is not happening on JAWS ( on windows ). Is there any specific settings / extra tags has to be added in order to read the same in JAWS ? Any thoughts ?
Share Improve this question asked Dec 5, 2018 at 10:15 Arun RamachandranArun Ramachandran 1,4027 gold badges24 silver badges37 bronze badges2 Answers
Reset to default 4The aria-label
attribute may be ignored if the element you are setting it on doesn't have a specified role. In your case, the <p>
doesn't have any semantic meaning other than just text.
See https://www.w3/TR/using-aria/#label-support
In particular, see the 8th bullet:
Don't use
aria-label
oraria-labelledby
on any other non-interactive content such asp
,legend
,li
, orul
, because it is ignored.
As an aside, it's a little unusual to have paragraph text read differently than what is visually displayed. So while you could use aria-hidden
and the "visually-hidden" class, that will cause problems for low vision users who rely on augmenting their web experience by running a screen reader along with a magnifier. They will be able to see some text on the screen but when they hear it, it won't match what they see.
Instead of aria-label
you can use the visually hidden text by moving your text into a <span>
with aria-hidden="true"
attribute
E.g.
<p className="inline">
<span aria-hidden="true">text</span>
<span class="visually-hidden">my custom text</span>
</p>
And visually hidden class will have :
.visually-hidden{
position: absolute;
overflow: hidden;
clip: rect(0 0 0 0);
height: 1px; width: 1px;
margin: -1px; padding: 0; border: 0;
}
本文标签: javascriptJAWS ( on windows ) not reading arialabel given on ltpgt tagStack Overflow
版权声明:本文标题:javascript - JAWS ( on windows ) not reading aria-label given on `<p>` tag - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744683082a2619532.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论