Re: Using aria-labelledby instead of <label> element

On Thu, 22 Mar 2012 12:22:41 +0100, Ramón Corominas  
<listas@ramoncorominas.com> wrote:

> We are developing a tool to manage different fields related to many  
> records in a dataset. The information is presented as a data table to  
> show and edit the values of each record, so the column headers act as  
> labels for each field, and row headers identify each record.

*In theory* if you are using th elements for the column and row headers,  
you should have this information for each table cell already.

In practice there is the headers attribute -  
http://www.w3.org/TR/html5/tabular-data.html#attributes-common-to-td-and-th-elements  
(it was also in HTML4) - that you can use to explicitly do this, and my  
memory (you should check this) is that you need to use it for some screen  
readers because they do not implement tables completely according to HTML.

But...
[...]
> Thus, we need to construct the "label" for each field combining both row  
> and column headers "Queen color", "Knight unit price", etc. We have  
> tested aria-labelledby to do this, and it seems to work fine with all  
> the screen readers and platforms that we have tested (JAWS & NVDA w/ IE  
> & FF, VoiceOver w/ Safari). We have also seen that this technique has  
> been submitted to the WCAG WG [1]. However, I cannot find it in the  
> Techniques document, so I don't know if there is a reason to avoiding it.
>
> What do you think? Would it be acceptable to use aria-labelledby as the  
> only way to label a form control?

If you want to label the form controls themselves (not just the cell they  
are in), this is probably reasonable in practice. But another question -  
how are you generating the aria labels in the first place - could you use  
that to generate real label elements, or is there some other reason not to  
use them or something they don't do?

cheers

Chaals

-- 
Charles 'chaals' McCathieNevile  Opera Software, Standards Group
     je parle français -- hablo español -- jeg kan litt norsk
http://my.opera.com/chaals       Try Opera: http://www.opera.com

Received on Thursday, 22 March 2012 14:25:02 UTC