如何限制屏幕阅读器不读取某个文本?

问题描述 投票:2回答:2

想象一下,我有一个<div>aria-label为“读这个”(aria-label在运行时添加)。在<div>内部,我有一个<span>文本“不读这个”。

现在Jaws正在做的是,它同时读取文本(“读这个”和“不读这个”)。

<div aria-label="Read this">
  <span>Do not read this</span>
</div>

期望只读“读这个”。反正是否限制屏幕阅读器强制停止阅读文本?

html accessibility wai-aria screen-readers jaws-screen-reader
2个回答
3
投票

aria-hidden="true"是你想要的东西

<div aria-label="Read this">
<span aria-hidden="true">Do not read this</span>
</div>

请注意,并非所有的屏幕阅读器都会读取aria-label元素上的div并且它将导致一个空白元素


0
投票

适用于JAWS 2018,chrome 72:

<div role="text" aria-label="Read this">
Do not read this
</div>
© www.soinside.com 2019 - 2024. All rights reserved.