问题描述
我正在使用Unicode星号显示产品评分.iOS VoiceOver无法正确朗读,因此我认为我应该在跨度上使用 aria-label
来告诉屏幕阅读器这是什么意思.
I'm showing product ratings using Unicode star symbols. iOS VoiceOver doesn't read this aloud correctly, so I thought I'd use aria-label
on my span to tell screen readers what it means.
<span aria-label="4.0 stars out of 5, 123 ratings">★★★★☆ 4.0 (123)</span>
它不起作用.iOS VoiceOver完全忽略了我的 aria-label
.
It's not working. iOS VoiceOver ignores my aria-label
completely.
我做错了什么?我该如何解决?
What am I doing wrong? How can I fix this?
推荐答案
如果您放置在元素上的元素没有任何语义含义,则某些辅助技术有时会忽略 aria-label
.< span>没有语义.如果您添加 角色
适合您的星星,则应正确阅读.
The aria-label
is sometimes ignored by some assistive technology if the element you put it on doesn't have any semantic meaning. A <span> doesn't have semantic meaning. If you add a role
that is appropriate for your stars, then it should be read correctly.
这篇关于在跨度上使用aria标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!