- 大多数屏幕阅读器默认阅读自定义工具提示信息。 role="tooltip"似乎没有做任何额外的事情,就像它没有通知用户它的工具提示。为什么我们需要为工具提示容器使用 role="tooltip"?有什么具体目的吗?
- NVDA 无法在 IE11 中读取工具提示信息。有什么破解方法可以解决吗?
这是我的代码:
<div class="ttipcontainer">
<button title="" class="co_tooltipElement" id="newButton05-2" aria-describedby="coid_accessibleTooltip_1"> Recent Searches </button>
<span tabindex="-1" class="co_accessibilityLabel" id="coid_accessibleTooltip_1" aria-hidden="true" role="tooltip">Shows information of your recent searches</span>
</div>
最佳答案
Heydon Pickering 有一个很好的写作指南 Accessible Toggle Tips .他在其中描述了为什么我们将 role=tooltip
放在元素上:
Note the use of the tooltip role. In practical terms, all this role offers is an assurance that aria-describedby works reliably where supported. As Léonie Watson writes, ARIA labels and descriptions sometimes don't work with all elements unless you incorporate an appropriate role. In this case, the most important role is the implicit button role of the subject element, but role="tooltip" may extend support for this labeling method in some software.
因此,虽然它没有提供太多额外信息,但它确实帮助 aria-describedby
指向具有有效角色的元素,这有助于确保它对某些屏幕阅读器正常工作。
关于html - 角色 ="tooltip"重要吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51195671/