【发布时间】:2022-08-18 22:40:05
【问题描述】:
在按钮中使用哪个角色是正确的,因此屏幕阅读器使用aria-label 属性。
<button class=\"favorite-button\">
<span class=\"material-symbols-outlined\"
aria-label=\"add to favorites\"
role=\"???\">
grade
</span>
</button>
所以我使用谷歌字体材料符号,没有 aria-label + 角色 \"grade\" 将被屏幕阅读器用户读取。 在这种情况下,哪个角色适合?
-
AFAIK button 标签是接收焦点的元素(浏览器可能会在其上查找特定的 aria 属性,而不是 span。另外:我认为 aria 角色是从 button 标签中隐含的,所以不需要。我认为设置按钮上的 aria-label 应该足够了。