Technique F49: Failure of Success Criterion 1.3.2 due to using an HTML layout table that does not make sense when linearized
Applicability
HTML and XHTML
This technique relates to 1.3.2: Meaningful Sequence (Failure).
Description
Although WCAG 2 does not prohibit the use of layout tables, CSS-based layouts are
recommended in order to retain the defined semantic meaning of the HTML table
elements and to conform to the coding practice of separating presentation from content.
If a layout table is used, however, it is important that the content make sense when
linearized.
This failure occurs when a meaningful sequence of content conveyed through presentation is lost because HTML tables used to control the visual placement of the content do not “linearize" correctly. Tables present content in two visual dimensions, horizontal and vertical. However, screen readers present this two-dimensional content in linear order of the content in the source, beginning with the first cell in the first row and ending with the last cell in the last row. The screen reader reads the table from top to bottom, reading the entire contents of each row before moving to the next row. The complete content of each cell in each row is spoken—including the complete content of any table nested within a cell. This is called linearization.
Suppose that a Web page is laid out using a table with 9 columns and 22 rows. The screen reader speaks the content of the cell at Column 1, Row 1 followed by the cells in columns 2, 3, 4 and so on to column 9. However, if any cell contains a nested table, the screen reader will read the entire nested table before it reads the next cell in the original (outer) table. For example, if the cell at column 3, row 6 contains a table with 6 columns and 5 rows, all of those cells will be read before Column 4, Row 6 of the original (outer) table. As a result, the meaningful sequence conveyed through visual presentation may not be perceivable when the content is spoken by a screen reader.
Examples
Example 1: A layout table that does not linearize correctly
An advertisement makes clever use of visual positioning, but changes meaning when linearized.
<table> <tr> <td ><img src="logo.gif" alt="XYZ mountaineering"></td> <td rowspan="2" valign="bottom">top!</td> </tr> <tr> <td>XYZ gets you to the</td> </tr> </table>
The reading order from this example would be:
- XYZ mountaineering top!
- XYZ gets you to the
Example 2: A layout table that separates a meaningful sequence when linearized
A Web page from a museum exhibition positions a navigation bar containing a long list of links on the left side of the page. To the right of the navigation bar is an image of one of the pictures from the exhibition. To the right of the image is the kind of "placard" text you'd see on the wall next to the object if you were at the museum. Below that text is a heading that says "Description," and below that heading is a description of the image. The image, placard text, Description heading, and text of the description form a meaningful sequence.
A layout table is used to position the elements of the page. The links in the navigation bar are split into different cells in the leftmost column.
<table> <tr> <td><a href="#">Link 1</a></td> <td rowspan="20"><img src="img.png" alt="Museum Picture"></td> <td rowspan="6"><img src="placard.png" alt="Placard text"></td> </tr> <tr> <td><a href="#">Link 2</a></td> </tr> <tr> <td><a href="#">Link 3</a></td> </tr> <tr> <td><a href="#">Link 4</a></td> </tr> <tr> <td><a href="#">Link 5</a></td> </tr> <tr> <td><a href="#">Link 6</a></td> </tr> <tr> <td><a href="#">Link 7</a></td> <td rowspan="2"><h2>Image Heading</h2></td> </tr> <tr> <td><a href="#">Link 8</a></td> </tr> <tr> <td><a href="#">Link 9</a></td> <td rowspan="12">Description of the image</td> </tr> <tr> <td><a href="#">Link 10</a></td> </tr> ... <tr> <td><a href="#">Link 20</a></td> </tr> </table>
The reading order from this example would be:
- Link 1
- Image
- Placard Text
- Link 2
- Link 3
- Link 4
- Link 5
- Link 6
- Link 7
- Image Heading
- Link 8
- Link 9
- Link 10
- ...
- Link 20
Because the navigation bar links are interleaved with the content describing the image, screen readers cannot present the content in a meaningful sequence corresponding to the sequence presented visually.
Tests
Procedure
-
Linearize the content in either of the following ways:
- Present the content in source code order
- Remove the table markup from around the content
- Check that the linear reading order matches any meaningful sequence conveyed through presentation.
Expected Results
- If check #2 is false, then this failure condition applies and the content fails this Success Criterion.