简体   繁体   English

如何对屏幕阅读器隐藏ARIA-LIVE,但使他们可以在其中阅读内容?

[英]How to hide ARIA-LIVE from screen readers but make they will can read content inside?

I have on page ARIA-LIVE block like this: 我在页面上的ARIA-LIVE块如下所示:

<div
  aria-live='polite'
  role='log'
  aria-relevant='additions'
  aria-atomic='false'
  style='position: absolute; width: 1px; height: 1px; margin-top: -1px; clip: rect(1px, 1px, 1px, 1px); overflow: hidden;'>
  <div>message</div>
  <div>message</div>
</div>

And now, if i using keyboard arrows, screen reader can reach aria-live zone, it is located at the very bottom of the page, and read content which he contain. 而现在,如果我使用键盘箭头,则屏幕阅读器可以到达Aria-live区域,它位于页面的最底部,并可以读取其中包含的内容。

Is there a way to hide the aria-alive zone but at the same time make it so that the content in it is still normally read by the reader? 有没有一种方法可以隐藏aria-alive区域,但同时又将其隐藏起来,以便读者仍然可以正常阅读其中的内容?

That's kind of like asking how can one apply CSS display:none to an element but still allow the element to be seen. 这有点像问如何将CSS display:none应用于元素,但仍然允许该元素可见。

You can hide elements from a screen reader by specifying aria-hidden="true" . 您可以通过指定aria-hidden="true"从屏幕阅读器隐藏元素。 If you also have aria-live , then any updates to that element will be hidden from screen readers, essentially negating the purpose of having aria-live . 如果您还拥有aria-live ,那么屏幕阅读器将隐藏对该元素的任何更新,从根本上消除了拥有aria-live的目的。

About the best you can do is associate a label with that region to say "this element is for announcing dynamic updates", or something like that. 最好的办法是将标签与该区域相关联,以表明“此元素用于宣布动态更新”或类似的内容。 A screen reader user may find it, but it doesn't hurt anything. 屏幕阅读器用户可能会找到它,但没有任何伤害。 They can easily ignore it and move on to the next element. 他们可以轻松地忽略它并继续进行下一个元素。

暂无
暂无

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

相关问题 从屏幕阅读器隐藏Aria-live(礼貌)内部div中的内容更改 - Hide content changes in div inside Aria-live ( polite ) from Screen readers 像 NVDA 这样的屏幕阅读器如何自动读取从 display: none 到 block 的元素? Aria-live 运行不正常 - How can screen readers like NVDA automatically read an element that goes from display: none to block? Aria-live not working well 屏幕阅读器如何通过aria-atomic处理嵌套的aria-live - How do screen readers handle nested aria-live with aria-atomic 当焦点从 aria-live 区域 div 获得输入字段时,如何防止屏幕阅读器停止阅读内容? - How can I prevent the screen reader from stopping to read the content when the focus is gained to the input field from an aria-live region div? 屏幕阅读器无法读取 Firefox 中的 Aria-Live - Aria-Live in Firefox not read by screen reader 在 aria-live 内容更新时阅读自定义消息 - Read customized message when content updates for aria-live Aria-live 内容被 Mac 读取两次 - Chrome - VoiceOver - Aria-live content read twice by Mac - Chrome - VoiceOver 防止屏幕阅读器聚焦“ aria-live”元素 - Prevent 'aria-live' element from being focused by screen reader 阅读咏叹调生活区域的标签 - Read label of aria-live region 向屏幕阅读器宣布某些文本的最佳方式是什么(即 role="alert", aria-live="assertive/polite")? - What is the best way to announce some text to screen readers (ie. role="alert", aria-live="assertive/polite")?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM