简体   繁体   English

只为屏幕阅读器隐藏文本

[英]Hide text ONLY for screen readers

I simply can't get the answer to this question. 我根本无法得到这个问题的答案。 The WCAG says it can be done by aria-hidden tag, but I've read it's not working at many screen readers. WCAG表示,可以通过aria-hidden标签完成此操作,但我了解到它不适用于许多屏幕阅读器。

Can't get how display:none can help to hide some text only for screen readers(=visible to other devices than SR). 无法获得display:none可以帮助隐藏一些适用于屏幕阅读器的文本(=除SR以外对其他设备可见)。 This is also not clear how would screen reader act for display:none if it not supports css. 这也不清楚屏幕阅读器将如何display:none如果不支持css,则没有display:none

Is there any technique or best practice or whatever I can use to hide some text only for screen readers? 是否有任何技术或最佳实践,或者我可以用来隐藏某些文本( 适用于屏幕阅读器)的任何方法?

Sorry, the best practice is to use aria-hidden attribute. 抱歉,最佳做法是使用aria-hidden属性。 Users with screen readers ignoring ARIA attributes should change their software. 屏幕阅读器忽略ARIA属性的用户应更改其软件。

aria-hidden should be used to hide any non-focusable content on a page from screen readers. aria-hidden应该用于对屏幕阅读器隐藏页面上所有不可聚焦的内容。 All major screen readers current versions support this well. 当前所有主要的屏幕阅读器版本都支持此功能。

In oder to satisfy WCAG 2 AA , a feature only needs to be supported on the common or at least one widely distributed free assistive technology. 为了满足WCAG 2 AA ,仅在通用或至少一种广泛使用的免费辅助技术上需要支持一项功能。 NVDA and Firefox on Windows, VoiceOver on OS X and iOS and Talkback with Firefox on Android all support this feature. Windows上的NVDA和Firefox,OS X和iOS上的VoiceOver以及Android上的Firefox对讲均支持此功能。

You can also use role="presentation" , depending of the tag, browser and screen reader it can be a better option (or worse). 您还可以使用role="presentation" ,这取决于标记,浏览器和屏幕阅读器,它可能是一个更好的选择(或更糟的选择)。 Take a look at this good tutorial, 看一下这个很好的教程,

HTML5 Accessibility: aria-hidden and role=”presentation” HTML5辅助功能:隐藏的aria和role =“ presentation”

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM