The HTML working group have decided not to include the
headers attribute in the HTML 5.0 working draft, as they believe the
scope attribute is sufficient for associating header cells with data cells. With simple and most complex tables, this is a reasonable assertion, but doesn't work with overlaid and irregular tables, where the associated headers aren't in the same column or row.
Author: Gez Lemon
There has been a lot of debate on the HTML mailing list and in the blogging community about the lack of the
headers attribute in the current HTML 5.0 working draft for the
th element and the
td element with data tables. HTML 4.01 includes a
headers attribute for
td elements that allows a space separated list of cells to be specified as headers for the cell containing the
headers attribute. The
headers attribute is vital for associating headers in irregular tables, or even quite simple tables with data that is overlaid.
The main reason
headers=""isn't currently in the HTML5 specification is not that there are no people talking about
headers="", it's that there is little to no use of
headers="", and that the little use there is is either incorrect or simple enough that
scope=""handles the cases fine anyway.
An Overlaid Table Example
It's not difficult to come up with an example where the scope attribute alone is not sufficient to describe the headers for a particular data cell. Consider the overlaid table below. The table has a conceptual divide that runs from the top-left corner to the bottom right, creating two triangles. There are four rows of headers along the top, right, bottom and left. Data cells on the shared hypotenuse have the same row and column headers. Data cells that belong to the lower-left triangle are headed by the left and bottom header cells, and the data cells that belong to the upper-right triangle are headed by the top and right header cells.
To help aid understanding the table, cells on the hypotenuse are white on a black background; cells in the lower-left triangle have a light green background; cells in the upper-right triangle have a transparent background. For example, cell 14 in the upper-right triangle has headers of D and 8; cell 19 is on the hypotenuse, so has headers of I, 4, 9, and D; cell 24 in the lower-left triangle has headers of I and 5.
|1||Cell 1||cell 2||Cell 3||Cell 4||Cell 5||6|
|2||Cell 6||Cell 7||Cell 8||Cell 9||Cell 10||7|
|3||Cell 11||Cell 12||Cell 13||Cell 14||Cell 15||8|
|4||Cell 16||Cell 17||Cell 18||Cell 19||Cell 20||9|
|5||Cell 21||Cell 22||Cell 23||Cell 24||Cell 25||10|
If the column and row headers were marked up with
scope, the relationship wouldn't be correct, as each row would be headed by the header cells on both sides of the row, and each column would be headed by the header cells at the top and bottom of the column.
Overlaid and other types of irregular tables are very rare on the web, but we still require a mechanism to mark them up correctly. Ideally, we could do with something more generic, like the
labelledby attribute from WAI-ARIA's state and properties Module, as this could be used to describe the associated headers for each cell, label for a form control, and so on. There is no mention of a generic attribute for labelling objects in the HTML 5 global attributes. Also, backwards compatibility is a concern for the HTML 5 working group, as they include a
font element for backwards compatibility with older WYSIWYG editors.
font element is purely presentational - if it wasn't supported, the worst thing that would happen in a user agent is that the text would be displayed without the presentational information. It doesn't create an accessibility barrier in the same way that removing something as vital for comprehension as the
headers attribute would.
There is no doubt that we require something that allows irregular data tables to be marked up so that they are understandable by assistive technology, and this is something that the
headers attribute does adequately right now. I would love to see something more generic introduced that would also work in other areas or rich internet applications, like WAI-ARIA's
labelledby attribute, but at the same time, we need to ensure whatever is proposed doesn't break the web. W3C technologies should be built considering accessibility from the ground up. I do hope that the HTML Working Group participants change their stance on this issue and consider keeping the
headers attribute, as we definitely need it to support accessibility.