W3C home > Mailing lists > Public > public-html@w3.org > September 2007

Re: headers= and rowgroup (was: Re: Data Table Collections (Research))

From: Leif Halvard Silli <lhs@malform.no>
Date: Wed, 12 Sep 2007 07:53:25 +0200
Message-ID: <db34087f2d0769274a5dbf68f4128a0a@10013.local>
To: "Anne van Kesteren" <annevk@opera.com>
Cc: "HTML WG" <public-html@w3.org>

On 2007-09-11 13:00:52 +0200 "Anne van Kesteren" <annevk@opera.com> wrote:
> On Mon, 10 Sep 2007 14:46:43 +0200, Leif Halvard Silli <lhs@malform.no>
>> 2007-09-09 12:43:34 +0200 "Anne van Kesteren" <annevk@opera.com>:
>>> Sun, 09 Sep 2007 05:34:50 +0200, Leif Halvard Silli <lhs@malform.no>

>> [ .. augmentative ... ]
>>> Another problem, which I think can only be worked around with headers=""
>>> (given that headers is not augmentative, I'm not sure about that) is  that
>> 
>> What do you mean by «augmentative» -[...]?

>    <tr><th id=foo>a    <td>b
>    <tr><th scope=row>c <td headers=foo>d
> 
> Is "d" associated solely with "a"  or also with "c"? I think my personal  
> preference would go out to just "a" so you have full control over edge  
> cases, 

I think HTML follows your preference. HTML4 cares more about avoiding unintended associations - than with the opposite problem, it seems. HTML4 doesn't, though, discuss an example like yours, and there also is no reason to use @SCOPE in that exact code sample. But here is a variant where @SCOPE has the effect of saying that «‹E› is not a header for ‹F› - only ‹c› is»:

 <tr><th id=foo>a   <TH>b <!--change from TD--><TH>E
 <tr><th scope=row>c<td headers=foo>d          <TD>F

>but it seems HTML4 suggests "a" and "c" (if you simply follow the  
> algorithm in 11.4.1).

For this e-maail, I'll guess that what makes you read HTML4 that way, is this sentence: «You should use the TD element for such cells together with the id or scope attributes as appropriate.»  Right?However, this sentence only aims to solve the problem of how to prepare a TD-cell to function as header cell. The solution it gives is this: Either you use @ID so it becomes reachable via @HEADERS from other cells, or you apply @SCOPE, (or you apply both, to make it possible to associate cells from outside the scope of @SCOPE).

It is probably because of the basic algorithm in 11.4.3 (which will automatically associate TH with all cells below or to the right of it), that HTML4 warns against overuse of TH. Both @SCOPE and @HEADERS help us to _avoid_ associations that otherwise would happen. (Hidden in this is perhaps also a warning against using TH-cells for the purpose of getting bold style text.) 

>> [ ... rowgroup => colgroup + col ... ]
>>> the rowgroup headers should not get the col headers. "Location" etc.  is 
>>> not an appropriate header for "Day 1 ..." etc.
>> 
>> As told in the other message, scope="rowgroup" seems here to used  wrongly.
> 
> Why? HTML4 says: "rowgroup: The header cell provides header information  for 
> the rest of the row group that contains it." The header cell is within  a 
> <tbody> which represents a row group so the header cell prevents the  header 
> information for the other cells in that <tbody>. Seems pretty clear  to me.

Symmetry (and context) is a strong argument, I think. 

Your quote is from Section 11.2.6 - the only place 'rowgroup' is explained:

row:     The current cell ... the rest of the row that contains it ...
col:     The current cell ... the rest of the column that contains ...
rowgroup: The header cell ... the rest of the row group that contai...
colgroup: The header cell ... the rest of the column group that con...

(I wonder what it means that row/col begins «The current» while rowgroup/colgroup begins «The header»?)

Both for rowgroup and colgroup one could get the thought that it is unclear whether «the rest of» is to be taken vertically or horisontally. But a symmetric reading would suggest that row and rowgroup stretches the same horisontal direction, and that col and colgroup stretches the same vertical direction. 

Also, to say that «rowgroup» reaches 'downwards' (without also saying that «colgroup» reaches «left-to-righ»), would create 3 possible scope levels vertically, but only 1 level horisontally. To say that «rowgroup» reaches left-to-right, however, would be 100% symmetric - «two levels: colgroup and col, or rowgroup and row  [...]» [1].

Furthermore, not only <tbody> is a rowgroup, but also <thead> and <tfoot>. And what, if "rowgroup" was to be read like you said, what should the point of having scope="rowgroup" inside the <thead> be? Should it be to forbid that the header cells in <thead> was propagated as headers for the rest of the table?

>> It must be broadcast the header-cell-presence from left-to-right - it 
>> cannot do it from top-to-bottom.
> 
> This is not said anywhere as far as I can tell.

Then what about <tr><td scope="colgroup">? Why is it only supposed to work vertically? It would be entirely thinkable to have it work horisontally. It is not written directly  anywhere that it cannot work horisontally - is it? (Both a horisontal scope=colgroup as well as a vertical scope=rowgroup makes some sense - per se. But how should the UA know whether SCOPE="rowgroup" was meant vertically or horisontally, unless we got some new attributes for that?)

>> Perhaps you could have used scope="colgroup" though: «colgroup: The 
>> header cell provides header information for the rest of the column group 
>> that contains it.»
> 
> There's no <colgroup> in the table. (And therefore no column group.)

Oops. Be aware of traps! :-) Ferg: «Misunderstanding of the use of SCOPE is practically guaranteed by an example in section 11.4.1 [...] the example does not point out is that — in the absence of explicit COLGROUP tags – all tables contain a single implicit colgroup. [...] That is the only reason this example works [...]» [2]

And likewise, we could say that all tables implicitly contain at least one row group. Otherwise, the simple table below would not be possible to do - with @SCOPE: 

ASCII-art 1):       ASCII-art 2): 
    |R   C O L G R |   |R _ _ C O L _ |
    |O R _ C O L _ |   |O _ C O L G R |
    |W O _ _ _ _ _ |   |W R _ _ _ _ _ |
    |G W _ _ _ _ _ |   |G O _ _ _ _ _ |
    |R _ _ _ _ _ _ |   |R W _ _ _ _ _ |
	[ ALT-text for ASCII-art 1): Table with 1 colgroup-header-row with 1 col-header-row below it, plus one rowgroup-header-colum with one col-header-colum left of it. ASCII-art 2): Same as 1) but COL above COLGROUP and ROWGROUP after ROW. ]

What I wonder about, though, is the restrictions on how to use @SCOPE.
How close is the relationship SCOPE=COLGROUP/<COLGROUP>, SCOPE=COL/<COL>, SCOPE=ROW/<TR> and SCOPE=ROWGROUP/TBODY/THEAD? Ferg says that «In order to use colgroups and rowgroups for any serious table markup, it is necessary to mark up the table with COLGROUP and TBODY tags. This adds an extra layer of complexity to the table markup.» [3] He does not speak about SCOPE=COL and SCOPE=ROW. I guess (and correcting myself from earlier) that SCOPE=ROW/COL will span over those columns/rows that the current cell spans over.

But for each <TD SCOPE=COLGROUP>, does it/is it supposed to cover exactly as many columns as the corresponding <COLGROUP> element does? And likewise for <td scope=rowgroup> versus TBODY/THEAD? And can a cell with scope=rowgroup/colgroup appear anywhere - or must it be the first cell in the table?

A clarification (or is it a correction?) of how Ferg explains it, could be to say that the only reason we have both colgroup/rowgroup as well as col/row is to enable support for until two simultaneous levels of headers - via scope. Nothing more, and nothing less.  If so, then the only link that SCOPE="COLGROUP" would have to the COLGROUP element and SCOPE="ROWGROUP" to the rowgroup elements, would be that they eventually - unlike SCOPE="col" and SCOPE="row" (?) - cannot exceed the limits of the rowgroups or the colgroup.

I see that Dave Ragget is one of the members of our group - so perhaps he can shed some light? ;-)

> (The references to "the table" (and similar references) are about my  
> http://annevankesteren.nl/2007/09/tmb-overview blogpost.)

[1] <http://www.ferg.org/section508/accessible_tables.html#contents_item_6.2.3>
[2] <http://www.ferg.org/section508/accessible_tables.html#contents_item_6.2.6>
[3] <http://www.ferg.org/section508/accessible_tables.html#contents_item_6.2.6>
-- 
leif halvard sillli
Received on Wednesday, 12 September 2007 05:53:56 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:49 UTC