简体   繁体   English

屏幕阅读器是否关注CSS?

[英]Do screen readers pay attention to CSS?

Do screen readers just read content without paying attention to CSS? 屏幕阅读器是否只是在不关注CSS的情况下阅读内容?

My reason for asking is that I would like to use LESS.js for some of my CSS (so not all of it). 我问的理由是我想将LESS.js用于我的一些CSS(所以不是全部)。 As far as I'm concerned, users with JS disabled will get a basic experience anyway so they won't miss some of my presentational CSS. 对于我而言,禁用JS的用户无论如何都将获得基本体验,因此他们不会错过我的一些演示CSS。

However, what about Screen Readers... will they miss my extra CSS that's served via Javascript? 然而,屏幕阅读器......他们会错过我通过Javascript提供的额外CSS吗?

PS no compiler suggestions please, I'm not interested - they slow down my workflow. PS没有编译器建议,我不感兴趣 - 他们放慢了我的工作流程。

Thanks 谢谢

The most important issue to understand here is that a screenreader is not a browser: it is an app that reads out the UI of other apps, either via speech, braille, some combination or the two - or possibly even some other means. 这里要理解的最重要的问题是屏幕阅读器不是浏览器:它是一个应用程序,可以通过语音,盲文,某种组合或两者来读取其他应用程序的用户界面 - 甚至可能是其他方式。

When reading the web, the screenreader doesn't actually load or parse HTML or CSS: the browser does that, and the screenreader reads out what gets displayed by the browser, typically by either accessing the underlying DOM directly (eg. on Win32 with IE, via the various IHTML* interfaces) or via an accessibility-related API. 在阅读网页时,屏幕阅读器实际上并没有加载或解析HTML或CSS:浏览器会这样做,并且屏幕阅读器会读取浏览器显示的内容,通常是直接访问底层DOM(例如,在Win32上使用IE浏览器) ,通过各种IHTML *接口)或通过与可访问性相关的API。

(Note that this means that support can vary depending on the screenreader and browser combination; JAWS can work against IE or Firefox, but not currently Chrome, Opera or Safari; and might in some cases actually read things out differently against IE vs Firefox.) (请注意,这意味着支持可能因屏幕阅读器和浏览器组合而异; JAWS可以针对IE或Firefox,但目前不适用于Chrome,Opera或Safari;在某些情况下,实际上可能会针对IE和Firefox进行不同的阅读。)

Usually this means that screenreaders ignore most CSS - they pretty much ignore most formatting and layout and concentrate on content; 通常这意味着屏幕阅读器会忽略大多数CSS - 它们几乎忽略了大多数格式和布局并专注于内容; but all modern screenreaders do take at least display: and visibility: into account, so they will not read out content that a sighted user would not see. 但是所有的现代屏幕阅读器都至少要考虑显示:和可见性:因此他们不会读出有视力的用户看不到的内容。 For example, a screenreader would not want to read out "collapsed" text - until it was appropriate to do so. 例如,屏幕阅读器不希望读出“折叠”文本 - 直到它适合这样做。 The key issue here is that these two CSS attributes actually have semantic meaning, so it's important for the screenreaders to convey that. 这里的关键问题是这两个CSS属性实际上具有语义含义,因此屏幕阅读器传达这一点非常重要。

Since the screenreaders get these values typically from the DOM (either directly or indirectly), it doesn't matter whether they were set via inline styles, an external stylesheet, or at runtime via javascript. 由于屏幕阅读器通常从DOM(直接或间接)获取这些值,因此无论是通过内联样式,外部样式表还是在运行时通过javascript设置它们都无关紧要。

-- -

A quick note on aural stylesheets: right now, they are simply not relevant at all to the screenreader scenario. 关于听觉样式表的快速说明:现在,它们与屏幕阅读器场景完全无关。

First, there's the issue that a screenreader user might not be using speech output in the first place. 首先,屏幕阅读器用户可能首先没有使用语音输出。

Secondly, most screenreader users have their voice set to a very specific voice - typically a neutral one that the user can understand well at high speeds - and then they'll pump up the speed to a very fast speed that most folks won't be able to understand at all. 其次,大多数屏幕阅读器用户将其语音设置为非常特定的语音 - 通常是用户可以高速理解的中性语音 - 然后他们将速度提高到非常快的速度,大多数人不会能够理解。 The last thing a screenreader user wants is for some page to start overriding their voice settings. 屏幕阅读器用户想要的最后一件事是让某些页面开始覆盖他们的语音设置。

This makes the screenreader experience fundamentally different from a speech-based UI (where an aural sheet might be appropriate). 这使得屏幕阅读器体验与基于语音的UI(其中听觉表可能是适当的)基本不同。 The UI is really still display-based; UI实际上仍然是基于显示的; it just happens to be accessed by the user in an indirect manner; 它恰好被用户以间接方式访问; and that indirection might be via speech, or braille, or some combination. 间接可能是通过言语,盲文或某种组合。 But you shouldn't have to care about that, so long as you have good semantic markup in your page in the first place. 但是,只要您在页面中首先拥有良好的语义标记,就不必关心它。

Yes and no. 是的,不是。 CSS needs to be parsed for the screen reader to know whether or not to read an item. 需要为屏幕阅读器解析CSS以了解是否阅读项目。 Items with display: none wont get read by a screen reader, however there are still other means of hiding content that can only be observed with a screen reader. 带有display: none不会被屏幕阅读器读取,但是还有其他隐藏内容的方法只能通过屏幕阅读器观察到。

I highly recommend downloading a development copy of JAWS or Window Eyes and performing an actual usability test of your site. 我强烈建议您下载JAWS或Window Eyes的开发副本,并对您的网站进行实际的可用性测试。

They're supposed to take cues from the CSS properties defined in the voice module when figuring out how read CSS styled text. 当弄清楚如何读取CSS样式文本时,他们应该从语音模块中定义的CSS属性中获取提示。

The aural rendering of a document combines speech synthesis (also known as "TTS", the acronym for "Text to Speech") and auditory icons (which we refer to as "audio cues" in this specification). 文档的听觉呈现结合了语音合成(也称为“TTS”,“文本到语音”的首字母缩写)和听觉图标(在本说明书中我们称为“音频线索”)。 The aural presentation of information is common amongst communities of users who are blind or visually-impaired. 在盲人或视力受损的用户群体中,信息的听觉呈现是常见的。 For instance, "screen readers" enable control of visual user-interfaces that would otherwise be inaccessible. 例如,“屏幕阅读器”能够控制可能无法访问的可视用户界面。 There are other cases whereby listening to textual information (as opposed to reading it) is a necessity. 在其他情况下,听取文本信息(而不是阅读文本信息)是必要的。 Typical examples include in-car use of an e-book reader, industrial and medical documentation systems, home entertainment, helping users to learn reading, or supporting users who have reading difficulties (print disabilities). 典型的例子包括电子书阅读器的车载使用,工业和医疗文件系统,家庭娱乐,帮助用户学习阅读,或支持阅读困难(阅读障碍)的用户。

When it comes to documents, the quality of the speech rendition depends on the structure and semantics authored within the content itself. 说到文档,语音再现的质量取决于内容本身内部的结构和语义。 The CSS Speech module provides properties that enable authors to declaratively control presentational aspects of the aural dimension (eg TTS voice, pitch, rate, and volume levels). CSS语音模块提供的属性使作者能够以声明方式控制听觉维度的表现方面(例如TTS语音,音调,速率和音量级别)。 These style sheet properties can be used together with visual properties (mixed media), or as a complete aural alternative to a visual presentation. 这些样式表属性可以与视觉属性(混合媒体)一起使用,或者作为视觉呈现的完整听觉替代方案。

Content creators can conditionally include CSS properties dedicated to user-agents with text to speech synthesis capabilities, by specifying the "speech" media type via the media attribute of the link element, or with the @media at-rule, or within an @import statement. 内容创建者可以有条件地包含专用于具有文本到语音合成功能的用户代理的CSS属性,通过链接元素的媒体属性或@media at-rule或@import指定“语音”媒体类型声明。 When doing so, the styles authored within the scope of such conditional statements are ignored by user-agents that do not support this module. 执行此操作时,不支持此模块的用户代理将忽略在此类条件语句范围内创作的样式。

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

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