[英]How to restrict screen reader to not read a certain text?
Imagine, I have a <div>
with aria-label
as "Read this" ( aria-label
is added at runtime). 想象一下,我有一个带有aria-label
的<div>
作为“ Read this”(在运行时添加了aria-label
)。 Inside the <div>
, I have a <span>
with text "do not read this". 在<div>
内部,我有一个<span>
,其文本为“请勿阅读此内容”。
Now what Jaws is doing is, it reads both the text ("Read this" and "do not read this"). 现在Jaws所做的是,它同时读取了文本(“读此”和“不读此”)。
<div aria-label="Read this">
<span>Do not read this</span>
</div>
The expectation is to only read "Read this". 期望仅阅读“阅读本文”。 Is there anyway to restrict screen readers to force stop reading a text? 是否有限制屏幕阅读器强制停止阅读文本的方法?
aria-hidden="true"
is the thing you want aria-hidden="true"
是您想要的东西
<div aria-label="Read this">
<span aria-hidden="true">Do not read this</span>
</div>
Note that not all screenreaders will read the aria-label
on a div
element and that it will result in a blank element 请注意,并非所有的屏幕阅读器都会读取div
元素上的aria-label
,并且它会导致空白元素
works for JAWS 2018, chrome 72: 适用于JAWS 2018,Chrome 72:
<div role="text" aria-label="Read this"> Do not read this </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.