简体   繁体   English

屏幕阅读器不是在阅读 aria-label 属性中的文本,而是在阅读元素中的文本

[英]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 文档”时阅读

如何定位元素<div aria-label></div><div id="text_translate"><p>我在 selenium java 中非常初级。 我正在尝试在亚马逊中找到该元素。</p><p> 当我尝试运行此代码时,我找不到该元素。 请帮助解决这个问题。</p><p> <a href="https://i.stack.imgur.com/eMWTB.png" rel="nofollow noreferrer">在此处输入图像描述</a></p><p>这是我的代码</p><pre> WebElement a_review= driver.findElement(By.xpath("//div[@aria-label='4 Stars &amp; Up']")); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();", a_review); a_review.click();</pre></div> - how to locate the element in <div aria-label>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果aria标签更改,则使屏幕阅读器重新读取 - Making a screen reader reread if the aria-label changes JAWS(在Windows上)无法阅读`上给出的aria标签。 <p> `标签 - JAWS ( on windows ) not reading aria-label given on `<p>` tag NVDA 在点击时读取按钮 aria-label 但不在 hover 上 - NVDA is reading button aria-label on click but not on hover 我需要使用链接文本作为 aria 标签将 aria-label 添加到网站上的所有链接 - I need to add aria-label to all links on the website using the link text as aria label 屏幕阅读器aria live断言文本被打断 - Screen reader aria live assertive text is interrupted 使用xpath单击aria-label元素 - Click a aria-label element using xpath 如何定位元素<div aria-label></div><div id="text_translate"><p>我在 selenium java 中非常初级。 我正在尝试在亚马逊中找到该元素。</p><p> 当我尝试运行此代码时,我找不到该元素。 请帮助解决这个问题。</p><p> <a href="https://i.stack.imgur.com/eMWTB.png" rel="nofollow noreferrer">在此处输入图像描述</a></p><p>这是我的代码</p><pre> WebElement a_review= driver.findElement(By.xpath("//div[@aria-label='4 Stars &amp; Up']")); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();", a_review); a_review.click();</pre></div> - how to locate the element in <div aria-label> Voice Over不读取行选择中表行的aria标签的内容 - Voice Over Not reading the content of aria-label of table row on Row selection aria-label 包含 HTML 文本,但只想听没有 html 元素描述的文本 - aria-label contain HTML text but want to listen only text without html elements description 使用键盘导航时无法读取aria-label属性 - aria-label attribute not being read when navigating using keyboard
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM