Skip to main content

Use the TH element to mark up table heading cells on the Web. Use the headers attribute on cells of complex data tables on the Web.

 

Rationale

There are two types of tables that are used in HTML. Data tables contain multiple rows and columns, and are used to present information to a user in a clean, concise manner. Layout tables are used to layout the images and text on a page. Layout tables do not contain tabular data and are only used for the visual layout.

When a user comes to a table, they must be able to understand the purpose of the table, and navigate the specific data that the table shows. Although it is fairly easy for a sighted user to navigate data tables, someone using assistive technology may have a difficult time navigating a data table and understanding its purpose or contents. The user may be unable to determine which data matches with which column or row header. Using the appropriate table markup techniques in this checkpoint will make your HTML tables easier for assistive technology users to understand and navigate.

The new features on Notes 7 support adding row and column headers to data tables on the Web or on the Notes client.

Development techniques

The following techniques are the minimum required to meet Checkpoint 5.5 from the Lotus Notes Application Accessibility Checklist:

The techniques in this checkpoint are organized by table type, with each table type requiring specific techniques.

Simple data tables
Complex data tables

Simple data tables

To make simple data tables accessible, identify row and column headers. The technique will vary depending on the version of Notes used. The techniques use the "Boys and Girls in Tarpon Elementary School" table.

Boys and Girls in Tarpon Elementary School
Class # of Boys # of Girls
1st Grade 11 10
2nd Grade 7 12
3rd Grade 9 11
4th Grade 13 12
5th Grade 12 12

In versions prior to Notes 7, pass-thru HTML must be used to add the TH element to identify row or column headers instead of using the default TD element. The span sample below shows the correct way to span table headers.

...
<tr>
<th>Class</th>
<th># of Boys</th>
<th># of Girls</th>
</tr>
<tr>
<th>1st Grade</th>
<td>11</td>
<td>10</td>
</tr>
.....

The HTML editor can also be used to add table headers using the following steps.

The screen shot below shows the HTML editor with a data table in the top pane. The HTML source in the bottom pane has been modified to add the TH element.

Domino HTML editor with data in the source pane modified to use the TH element.

Complex data tables

Complex data tables are defined as having two or more levels of row or column headings or headings that span multiple rows or columns. Complex data tables require additional markup to explicitly associate the heading with the data. In the data cells, the headers attribute is used on the TD element to specify which heading cell is associated with a specific data cell. The techniques in this section use the "Students in Tarpon Elementary by Teacher" table.

Students in Tarpon Elementary by Teacher
Class Teacher # of Boys # of Girls
1st Grade Mr. Henry 5 4
Mrs. Smith 7 9
2nd Grade Mr. Jones 3 9
Mrs. Smith 4 3
Mrs. Kelly 6 9

Adding id attributes to the first cell in each row and to other row cells that could be perceived as headers for subsequent cells in the row makes it explicitly clear which column and row headers apply to a particular cell. For example, it is now clear that both 1st Grade and Mr. Henry are row headers for the cell containing 5. This markup does not change the visual look of the table, but a screen reader user will able to better understand the relationships between the cells.

The pass-thru HTML span below shows the correct markup of the 1st Grade portion of the table. Notice that the column and row headers are marked with the id attribute, and the corresponding data cells contain the headers attribute. In addition, the cell containing Mr. Henry is a header cell as well as a data cell, and therefore it contains both the id and headers attributes.

...
<tr>
<th id="class">Class</th>
<th id="teacher">Teacher</th>
<th id="boys"># of Boys</th>
<th id="girls"># of Girls</th>
</tr>

<tr>
<th id="1stgrade" rowspan="2">1st Grade</th>
<th id="MrHenry" headers="1stgrade teacher">Mr. Henry</th>
<td headers="1stgrade MrHenry boys">5</td>
<td headers="1stgrade MrHenry girls">4</td>
</tr>

<tr>
<th id="MrsSmith" headers="1stgrade teacher">Mrs. Smith</th>
<td headers="1stgrade MrsSmith boys">7</td>
<td headers="1stgrade MrsSmith girls">9</td>
</tr>

Recommended techniques

The following techniques are recommended to enhance accessibility of data tables:

This screen shot shows the Table Properties box with the summary attribute added in the Other field on the Table Programming tab.

The Other field of the Table Programming tab is spand as summary=Sample complex table.  The value of the summary is in quotation.

Testing techniques

 

Techniques

The following techniques are required to verify this checkpoint:
  Action Result
1.
This step applies only if the application uses the Web interface.

View the page with a screen reader using its table reading mode.

As you navigate from column to column and row to row, verify that the screen reader announces table headers and cell contents.
Pass:


Fail:


©2001, 2008 IBM Corporation

Last updated February 08, 2008.