Screen Readers and Cascading Style Sheets

Hiding Content with CSS

When more web developers started moving from tag soup and table-based design to standards-based design and CSS-based layouts, some developers looked for techniques to hide skip navigation links. Some developers used the CSS rule display: none to hide skip links, assuming that this would hide the skip links only in the visual modality but not in the aural modality.

Note that the CSS 1 specification does not make assumptions about the modality in its definition of display:none except where it mentions the “surrounding box”: A value of ‘none’ turns off the display of the element, including children elements and the surrounding box. The CSS 2 specification, however, may have confused developers by its emphasis on boxes: This value causes an element to generate no boxes in the formatting structure (i.e., the element has no effect on layout). Descendant elements do not generate any boxes either; this behavior cannot be overridden by setting the ‘display’ property on the descendants. The specification also points out that display:none is not the same as creating an invisible box.

(The sample stylesheet for HTML 4.0 contains the rule HEAD { display: none }; display: none is not used anywhere else in this stylesheet.)

The draft of CSS3 module: The box model finally solves the ambiguity by defining the effect of display:none as follows: The element is not rendered. The rendering is the same as if the element had been removed from the document tree, except for possible effects on counters (see [generated] or [paged]).

The next two sections reproduce test results from 2003 and 2005.

Survey results from testing in 2003

Note: More recent results, June 2005, are available on Bob Easton’s [Access Matters blog].

Screen Reader or user agent linked imported aural empty link off-left notes
display:none visibility:hidden display:none visibility:hidden display:block
heard/seen heard/seen heard/seen heard/seen heard/seen heard/seen heard/seen 1,2
Jaws 4.51 with IE6 no/no no/no yes/no yes/no no/no yes/no yes/no 3
Jaws 5.00.297 (beta) no/no no/no yes/no yes/no no/no yes/no ?/? 3
Jaws 6 no/no no/no no/no no/no no/no yes/? yes/?  
Window Eyes 4.211 no/no no/no no/no no/no no/no no/no yes/no  
IBM Home Page Reader 3.01 no/no no/no no/no no/no no/no no/no yes/no  
IBM Home Page Reader 3.02 no/no no/no no/no no/no no/no no/no yes/no  
pwWebSpeak yes/yes yes/yes yes/yes yes/yes yes/yes yes/no yes/yes 6
Connect OutLoud? 2.0 yes/no yes/no yes/no yes/no yes/no yes/no yes/no 7
HT Reader 3.5 yes/? yes/? yes/? yes/? yes/? ?/? ?/? 6
Start Speaking - Mac OSX w/Safari yes/no yes/no yes/no yes/no yes/no no/no yes/no  
Microsoft Narrator- Win2k w/IE6 no/no no/no yes/no yes/no no/no yes/no yes/no  
Lynx na/yes na/yes na/yes na/yes na/yes na/no na/yes 4
Opera’s accessibility layout na/yes na/yes na/yes na/yes na/yes na/no na/yes 5
Opera’s small screen pda emulation na/yes na/yes na/yes na/yes na/yes na/no na/yes 5
MSN TV na/yes na/no na/yes na/no na/yes na/no ?/?  
MAGic Screen Magnifier & IE6 no/no no/no no/no no/no no/no no/no ?/?  

Notes:

  1. Styles coded as embedded or inline in the html behave identical to having the styles within linked style sheets.
  2. @import occurring within a linked style sheet produces results identical to having the @import directive in the <style> element of the html.
  3. Jaws speaks these only because it does not heed imported style sheets. When Jaws does learn to import style sheets, it will not speak these either.
  4. Sometimes used with screen readers.
  5. Not a screen reader, but indicative in some ways.
  6. I am guessing that these products do not read CSS.
  7. Almost too good to believe! Aimed specifically at Internet users, maybe this Freedom Scientific product is paying attention to standards?

Source: Screenreader Visibility (css-discuss).

Visibility Test Results from 2005 (Access Matters)

Table 1: How do screen readers handle material that we try to hide from visual display? Each answer states if the test material is heard/seen. The preferred answer is y/n. NT means not tested.
Screen Reader or user agent 1: inline display: none 2: linked style sheet with display: none 3: imported style sheet with display: none 4: aural style sheet with speak: normal 5: 1 x 1 spacer image with ALT text 6: 10 x 1 spacer image with ALT text 7: overflow: hidden and no size 8: absolute position above window 9: absolute position to left of window 10: clipped text 11: negative text indent 12: negative letter spacing
Connect OutLoud 2 n/n y/n y/n n/n n/n n/n y/n y/n y/n y/* y/n y/n
Jaws 4 and IE 6 n/n y/n y/n n/n n/n y/n y/n y/n y/n y/* y/n y/*
Jaws 5 and IE 6 n/n n/n y/n n/n y/n y/n y/n y/n y/n y/* y/n y/n
Jaws 6 and IE 6 n/n n/n n/n n/n y/n y/n y/n y/n y/n y/* y/n y/*
Window Eyes 4.5 and IE 6 n/n n/n n/n n/n y/n y/n n/n n/n n/n n/n n/n n/n
Window Eyes 5 and IE 6 n/n n/n n/n n/n y/n y/n n/n y/n y/n y/n y/n y/n
IBM HPR 3.04 and IE 6 n/n n/n n/n n/n y/n y/n y/n y/n y/n y/* y/n y/*
pwWebSpeak 3 y/y y/y y/y y/y y/y y/y NT NT NT NT NT NT
Mac OSX Text to Speech NT y/n y/n NT NT NT NT NT NT NT NT NT
Microsoft Narrator NT y/n y/n NT NT NT NT NT NT NT NT NT
Opera 8 with Voice NT y/n n/n n/n y/n y/n y/n y/n y/n y/n y/n y/n
Voice Over and Safari 2.0 NT NT NT NT NY NT y/n y/n y/n y/* y/n y/*
Lynx -/y -/y -/y -/y -/y -/y -/y -/y -/y -/y -/y -/y
Fangs for Firefox (*) n/n n/n n/n n/n y/n y/n y/n y/n y/n y/n y/n y/n

Notes:

Source: Screen Reader Visibility Test Results (Access Matters.

CSS Layout

A summary of tests is available at Screen Readers and CSS Layout (by Access Matters, 2005). The tests used four designs from CSS Zen Garden. The executive summary:

Current versions of the three leading screen readers speak page contents in the exact order the content is coded in the HTML source. CSS positioning is irrelevant.

Yes, other products and older versions of these same products might perform differently.

In the table below, reproduced from the above web site, a “-” means that content was hidden with display:none, and “X” means that content was spoken by the screen reader or user agent. The programs tested were Jaws 6.1 (J), Window Eyes 5.0 (W), IBM Home Page Reader 3.04 (H).

  ZG 000 ZG 019 ZG 151 ZG 167
Content Elements J W H J W H J W H J W H
1 title: CSS Zen Garden… - - X - - X - - X - - X
pageHeader
2 h1: CSS Zen Garden - - - - - - - - - - - -
3 h2: The Beauty of CSS Design - - - - - - - - - - - -
quickSummary
4 p1: A demonstration of what … X X X X X X - - - - - -
5 p2: Download the sample … X X X X X ? - - - X X X
preamble
6 h3: The Road to Enlightenment X X X - - - X X X - - -
7 p1: Littering a dark and … X X X X X ? X X X X X X
8 p2: Today, we must clear … X X X X X X X X X X X X
9 p3: The css Zen Garden … X X X X X X X X X X X X
explanation
10 h3: So What is This About X X X - - - X X X - - -
11 p1: There is clearly a need … X X X X X X X X X X X X
12 p2: CSS allows complete … X X X X X X X X X X X X
participation
13 h3: Participation X X X - - - X X X - - -
14 p1: Graphic artists only … X X X X X X X X X X X X
15 p2: You may modify the … X X X X X X X X X X X X
16 p3: Download the sample … X X X X X X X X X X X X
benefits
17 h3: Benefits X X X - - - X X X - - -
18 p1: Why Participate? … X X X X X X X X X X X X
requirements
19 h3: Requirements X X X - - - X X X - - -
20 p1: W would like to see … X X X X X X X X X X X X
21 p2: Unfortunately, designing … X X X X X X X X X X X X
22 p3: We ask that you … X X X X X X X X X X X X
23 p4: This is a learning … X X X X X X X X X X X X
24 p5: Bandwidth graciously … X X X X X X X X X X X X
footer
25 validation links … X X X X X X X X X X X X
lselect
26 h3: Select a Design X X X - - - X X X - - -
27 list of 8 designs.. X X X X X X X X X X X X
larchives
28 h3: Archives X X X - - - X X X - - -
29 list of 2 archives X X X X X X X X X X X X
lresources
30 h3: Resources X X X - - - X X X - - -
29 list of 5 resources X X X X X X X X X X X X
Recordings (about 1.2mb each) J W H J W H J W H J W H

Recordings for VoiceOver Mac OS X 10.4 Tiger are available at the Webcrumbs blog. The results were different for the fourth design: the download links were read first.

Roger Johansson says he tested the pages with Apple VoiceOver with similar results as those available at Access Matters. Turning Full Keyboard Access on or off (which Joe Clark suggested) did not seem to make a difference.

Image Replacement

There are links to test cases at Quiz 1.1.4: Image Replacement Techniques (by Access Matters) but there are few test results in the comments, and the results are not always easy to interpret. The comments also contain links to other image replacement techniques.

Screen reader or user agent Lehy/Langridge Phark Gilder/Levin sIFR
heard/link access heard/link access heard/link access heard/link access
Apple VoiceOver + Safari 2.0 yes/by pressing Ctrl-Option-Space bar yes/by pressing Ctrl-Option-Space bar yes/by pressing Ctrl-Option-Space bar yes/by pressing Return
Safari 1.3 and 2.0 NA/by pressing Return NA/by pressing Return NA/by pressing Return NA/by pressing Return (no hover feedback)
Opera 8 with Voice ? ? ? ?
Jaws 5 with IE6 yes/yes yes/yes yes/yes yes/yes

Alastair Campbell also has a short article on Image replacement and Voiceover.

Generated Content

In the section on "Generated content, automatic numbering, and lists" of the current last call working draft of CSS 2.1, I found the following statement: Generated content does not alter the document tree. In particular, it is not fed back to the document language processor (e.g., for reparsing). (The ‘content’ property).

The current CSS 2 specification says the same thing (The ‘content’ property; just before section 12.3).

In CSS Accessibility, Jim Allan notes that: Current assistive technology relies on what the user's browser supports, that is what can the browser display on the screen). If the browser does not support a CSS rule, the user/AT will not “see” it.

Christophe Strobbe: Christophe.Strobbe ( @ ) esat.kuleuven.be