在跨度上使用aria标签 [英] Use aria-label on a span

查看:55
本文介绍了在跨度上使用aria标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆