W3C home > Mailing lists > Public > w3c-wai-gl@w3.org > April to June 2004

[techs] The TH Rule

From: Chris Ridpath <chris.ridpath@utoronto.ca>
Date: Mon, 10 May 2004 14:42:44 -0400
Message-ID: <02d101c436be$95421a80$b040968e@WILDDOG>
To: "WAI WCAG List" <w3c-wai-gl@w3.org>

We've been looking at using the "TH" rule to differentiate different HTML
table types. The proposal is that all data tables must have TH elements
while all layout tables cannot have TH elements. This would make it easy for
assistive technologies to determine the table type and render the
information more accurately to the user.

I took an action to look at how this may impact tables as they are currently
used on the web.

As examples of real word tables, I used the Yalin Wang database of tables

Of the over 14000 tables in the database, I looked at a random sample of
about 2000 tables and graded them as layout or data. In most cases it was
easy to decide the table type but I discovered several tables that didn't
fit into either category. (If you're interested in grading these tables
yourself, I've written a small program to assist the process. Please contact
me for more info.)

In some cases, authors combined both data and layout into one table [2].
This is very confusing to the viewer and we should discourage this practice.
Use a table for one purpose only.

The majority of tables in use on the web are used for layout. In my sample
89% of the tables were layout, only 11% were data. We're asking authors to
use CSS instead of TABLE elements but the reality is that layout tables are
in wide use.

Only a very small number (< 1% in my sample) of layout tables use TH
elements. This is an improper use of TH when other markup such as a heading
or STRONG should be used [4]. Not a big problem but we should continue to
discourage authors from doing this.

Most data tables are missing TH elements. In my sample a whopping 87% of the
data tables were without TH elements. Most authors leave off the headings of
their data tables or mark one of the TD elements incorrectly as B or STRONG
[3]. We need to more strongly encourage authors to put TH elements into
their data tables.

Exceptions to the TH rule:

Tables are often used to layout form controls. This is a kind of layout
table but also acts like a data table because the cells can't be moved
without affecting their meaning [5]. In this type of table the TH elements
are not as necessary because each control has an associated label. I suggest
that tables used to layout form controls can have an optional row/column of
TH elements.

Tables are sometimes used to display "tables of contents" [6]. These are
really data tables but I don't think they require TH elements. A "table of
contents" is generally understood to include a title (e.g. chapter name)
associated with a location (e.g. page number). When the viewer encounters a
number within a table of contents they don't need to be reminded that this
is the page number, they already know that because of the table's purpose. I
suggest that tables used for "table of contents" purposes may have optional
TH elements.


All tables with only one row are layout tables.

The scope attribute must also be used with TH elements. In my testing with
Jaws 4.5 I noticed that the TH elements were not read with the data cells
unless the TH elements also had the scope attribute. I've heard that other
screen readers behave the same way. Assistive technologies should be able to
use the TH element alone but it appears that since the TH rule is not widely
used they have taken to use the scope attribute.


[1] http://www.math.harvard.edu/~ylwang/doc/webtablegrnd.zip
Received on Monday, 10 May 2004 14:43:29 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 16 January 2018 15:33:49 UTC