屏幕阅读器会关注 CSS 吗?

发布于 2024-12-17 15:50:25 字数 232 浏览 4 评论 0原文

屏幕阅读器是否只阅读内容而不关注 CSS?

我问这个问题的原因是我想将 LESS.js 用于我的一些 CSS(所以不是全部)。就我而言,禁用 JS 的用户无论如何都会获得基本的体验,因此他们不会错过我的一些演示 CSS。

然而,屏幕阅读器呢……他们会错过我通过 Javascript 提供的额外 CSS 吗?

PS 请不要提供编译器建议,我不感兴趣 - 它们会减慢我的工作流程。

谢谢

Do screen readers just read content without paying attention to CSS?

My reason for asking is that I would like to use LESS.js for some of my CSS (so not all of it). 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.

However, what about Screen Readers... will they miss my extra CSS that's served via Javascript?

P.S. no compiler suggestions please, I'm not interested - they slow down my workflow.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

美人如玉 2024-12-24 15:50:25

这里要理解的最重要的问题是屏幕阅读器不是浏览器:它是一个可以通过语音、盲文、某种组合或两者的组合(甚至可能是其他方式)读出其他应用程序 UI 的应用程序。

阅读网页时,屏幕阅读器实际上并不加载或解析 HTML 或 CSS:浏览器会执行此操作,屏幕阅读器通常会通过直接访问底层 DOM 来读取浏览器显示的内容(例如,在使用 IE 的 Win32 上) ,通过各种 IHTML* 接口)或通过与辅助功能相关的 API。

(请注意,这意味着支持可能会根据屏幕阅读器和浏览器组合的不同而有所不同;JAWS 可以在 IE 或 Firefox 上工作,但目前不能在 Chrome、Opera 或 Safari 上工作;并且在某些情况下,实际上在 IE 和 Firefox 上读取的内容可能有所不同。)

通常这意味着屏幕阅读器会忽略大多数 CSS - 他们几乎忽略大多数格式和布局并专注于内容;但所有现代屏幕阅读器至少都会考虑显示:和可见性:,因此它们不会读出视力正常的用户看不到的内容。例如,屏幕阅读器不想读出“折叠”文本 - 直到适合这样做为止。这里的关键问题是这两个 CSS 属性实际上具有语义含义,因此屏幕阅读器传达这一点很重要。

由于屏幕阅读器通常从 DOM(直接或间接)获取这些值,因此它们是通过内联样式、外部样式表还是在运行时通过 javascript 设置并不重要。

--

关于听觉样式表的快速说明:现在,它们与屏幕阅读器场景根本不相关。

首先,存在的问题是屏幕阅读器用户可能一开始就没有使用语音输出。

其次,大多数屏幕阅读器用户将其声音设置为非常特定的声音 - 通常是用户可以在高速下很好地理解的中性声音 - 然后他们会将速度提高到大多数人不会的速度完全能够理解。屏幕阅读器用户最不想看到的就是某些页面开始覆盖他们的语音设置。

这使得屏幕阅读器的体验与基于语音的 UI(听觉表​​可能更合适)有着根本的不同。 UI实际上仍然是基于显示的;它只是恰好被用户以间接的方式访问;这种间接的方式可能是通过言语、盲文或某种组合。但您不必关心这一点,只要您的页面首先有良好的语义标记即可。

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.

(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.)

Usually this means that screenreaders ignore most CSS - they pretty much ignore most formatting and layout and concentrate on content; 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.

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.

--

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). The UI is really still display-based; 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.

帅哥哥的热头脑 2024-12-24 15:50:25

当弄清楚如何阅读 CSS 样式的文本。

文档的听觉渲染结合了语音合成(也称为“TTS”,“文本到语音”的缩写)和听觉图标(在本规范中我们将其称为“音频提示”)。信息的听觉呈现在盲人或视障用户群体中很常见。例如,“屏幕阅读器”可以控制原本无法访问的可视用户界面。在其他情况下,聆听文本信息(而不是阅读文本信息)是必要的。典型示例包括电子书阅读器的车内使用、工业和医疗文档系统、家庭娱乐、帮助用户学习阅读或支持有阅读困难(阅读障碍)的用户。

就文档而言,语音翻译的质量取决于内容本身的结构和语义。 CSS 语音模块提供的属性使作者能够以声明方式控制听觉维度的表示方面(例如 TTS 语音、音调、速率和音量级别)。这些样式表属性可以与视觉属性(混合媒体)一起使用,或者作为视觉呈现的完整听觉替代方案。

内容创建者可以有条件地包含专用于具有文本到语音合成功能的用户代理的 CSS 属性,方法是通过链接元素的媒体属性指定“语音”媒体类型,或使用 @media at 规则,或在@import 语句。这样做时,不支持此模块的用户代理将忽略在此类条件语句范围内编写的样式。

They're supposed to take cues from the CSS properties defined in the voice module when figuring out how read CSS styled text.

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). 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 (e.g. TTS voice, pitch, rate, and volume levels). 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. When doing so, the styles authored within the scope of such conditional statements are ignored by user-agents that do not support this module.

离不开的别离 2024-12-24 15:50:25

是和不是。屏幕阅读器需要解析 CSS 才能知道是否阅读某个项目。屏幕阅读器不会读取带有 display: none 的项目,但是还有其他方法可以隐藏只能通过屏幕阅读器观察到的内容。

我强烈建议下载 JAWS 或 Window Eyes 的开发副本,并对您的网站进行实际可用性测试。

Yes and no. CSS needs to be parsed for the screen reader to know whether or not to read an item. 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.

I highly recommend downloading a development copy of JAWS or Window Eyes and performing an actual usability test of your site.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文