[whatwg] One label: multiple fields

Asbjørn Ulsberg asbjorn at tigerstaden.no
Tue Mar 13 13:18:53 PDT 2007


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»



More information about the whatwg mailing list