W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2007

[whatwg] One label: multiple fields

From: Asbjørn Ulsberg <asbjorn@tigerstaden.no>
Date: Tue, 13 Mar 2007 21:18:53 +0100
Message-ID: <op.to49drga16f2qb@quark>
On Tue, 13 Mar 2007 18:37:31 +0100, Elliotte Harold  
<elharo at metalab.unc.edu> wrote:

>              Homework 1  Homework 2 Homework 3
> John Smith    87           86         98
> Jane Jones   100           78         98
> Fred Wilde    89           65         69

I'd mark this up as follows:

   <table>
     <thead>
       <tr>
         <th colspan="2">Homework 1</th>
         <th>Homework 2</th>
         <th>Homework3</th>
       </tr>
     </thead>
     <tbody>
       <tr>
         <th scope="row">John Smith</th>
         <td><input ...></td>
         <td><input ...></td>
         <td><input ...></td>
       </tr>
     </tbody>
   </table>

I think this gives enough semantics for the UA to defer that "John Smith"  
is the label, header or whatever you might call it, for all of the  
successive td columns. The same applies for the td's in <thead>, which by  
default have 'scope="col"' (not DOM-wise, but semantically).

<http://www.w3.org/TR/html401/struct/tables.html#adef-scope>

> Anyone else want to chime in here? Has anybody else noticed a need that  
> would be solved by essentially changing the for attribute from IDREF to  
> IDREFS? Thoughts?

I wouldn't be against it, but considering the accessibility use in  
<label>, I can't quite get how it's supposed to work when it points to  
several different elements. A "click" event against the label now triggers  
focus() on the target element. What is supposed to happen in your use case?

-- 
Asbj?rn Ulsberg     -=|=-    http://virtuelvis.com/quark/
?He's a loathsome offensive brute, yet I can't look away?
Received on Tuesday, 13 March 2007 13:18:53 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:53 UTC