SCOPE, ROWSPAN and COLSPAN

	The SCOPE attribute for table header cells (either actual THs
or TDs which do double duty as data and headers) can be used to define
the header as corresponding to an entire row or column without the
extra complexity of using ID and HEADERS, but the HTML 4.0
documentation does not go into much detail on what SCOPE=row (column)
means if some of the cells in question span multiple rows (columns).

	If the header itself spans multiple rows (columns) and has
SCOPE=row (column), it seems to me reasonable to declare that it
applies to cells in all of the spanned rows (columns).  Not only does
this make a certain amount of sense, but it allows a common table
structure to be described simply.  If we're talking about multiple
columns, of course, we could define a COLGROUP and give the header
SCOPE=colgroup instead, but to do the same thing for multiple rows,
we'd need to split up the TBODY.  Since we can't have nested TBODYs,
we might want to represent a major division with the change from one
TBODY to another and not "waste" it on a couple of rows that happened
to share header information.  (I think the long-term solution to this
is to add a ROWGROUP element which contains TRs and can appear in
THEAD, TBODY, TFOOT or ROWGROUP, and also to allow nesting of
COLGROUPs.  This is not just for purposes of SCOPE=rowgroup or
SCOPE=colgroup header identification, but also to allow richer table
structures to be encoded.)

	It's a little less clear how we should think of a data cell
which spans multiple rows (columns) whose headers have SCOPE=row
(col).  I think in that case it's better to think of the cell as
having incarnations in all of the relevant rows.  So in the table
+-----+
|A|B|C|
+-+-+-+
|1  |2|
+-+-+-+
if the lettered cells are all TH SCOPE=col, one should not think of
the TD labelled 1 as simultaneously having A and B as headers, but as
residing in the first column with A as a header and also in the second
column with B as a header.  This becomes more of an issue if we switch
rows and columns in this example and add some more cells:
+-+-+-+
|A| |3|
+-+1+-+
|B| |4|
+-+-+-+
|C|2|5|
+-+-+-+
Now, in this example, a screen reader might speak the cell 1 twice,
once before 3 and once before 4.  And in that case, if all three
headers have SCOPE=row, it would be reasonable to give A as the header
the first time and B the second.  This is actually a relationship
which *cannot* be encoded with HEADERS (which may indicate it's an
incorrect interpretation).

	As a final aside, shouldn't the use of the HEADERS attribute
on TH (as opposed to TD) be extremely rare, since cells which act as
both headers and data should be represented with TD?  Because, again,
using SCOPE might result in header cells being associated with each
other if there are multiple headers for the same row or column, as in
+-----+
|  A  |
+-+-+-+
|a|b|c|
+-+-+-+
|1|2|3|
+-+-+-+
However, judging by the statement "row: The current cell provides
header information for the rest of the row that contains it (see also
the section on table directionality), " SCOPE only associates a header
with cells that follow it in the table, so if A, a, b, and c all have
SCOPE=col, that's the same as A having no HEADERS; a, b, and c all
having HEADERS=A; 1 having HEADERS="A a" etc., which is once again
the standard intepretation.  (In particular, A does not have an implied
HEADERS="a b c".)

					John T. Whelan
					whelan@iname.com
					http://www.slack.net/~whelan/

Received on Saturday, 15 August 1998 02:59:28 UTC