[英]Screen Reader is not reading the text in the aria-label attribute but its reading the text in the element
I have the following html elements.我有以下 html 个元素。 The count is in span element and text is in DIV tag.
计数在 span 元素中,文本在 DIV 标记中。 When I hover on the count it is reading only the number and when I hover on the text of the DIV tag, it is reading only text.
当我 hover 计数时,它只读取数字,当我 hover 对 DIV 标签的文本时,它只读取文本。 But I want the screen reader to read the complete text as '1 Document'.
但我希望屏幕阅读器将完整的文本阅读为“1 个文档”。 For that I kept 'aria-label' attribute with count and text for the parent DIV with class 'list-item'.
为此,我为带有 class 'list-item' 的父 DIV 保留了带有计数和文本的 'aria-label' 属性。 But still its reading only text 'Document' but not the count as a whole.
但它仍然只读文本“文档”,而不是整个计数。
<div class="list-item" title="documents" aria-label ="1 Document">
<span class="rt-count">1</span>
<div title="Documents" class="list-item-title" aria-labelledby="1 Document">Document</div>
</div>
You better try like this你最好这样试试
<div class="list-item" title="documents" aria-label ="1 Document">
<div title="Documents" class="list-item-title"><span class="rt-count">1</span> Document</div>
</div>
now you it can read on hovering of div text "1 Document"现在您可以在悬停 div 文本“1 文档”时阅读
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.