Re: Formalization of rule 91

So, you agree that every input (whose type is checkbox or radio), also 
must have one explicitly associated label, don't you?

In other words:

//input[@type = "radio"][let $ff:=self::node() return
  count(//label[@for=$ff/@id]) != 1] = ()

//input[@type = "checkbox"][let $ff:=self::node() return
  count(//label[@for=$ff/@id]) != 1] = ()

However, I have found a simple example where using a label tag is not so 
easy: http://www.it.uc3m.es/vlc/wai/a_complicated_form.html

As you will see, in the first fieldset (the second fieldset has no 
problem), we have 4 resources (namely resources #1-4). We could have many 
more, so each one has to be very simple. Each resource has as 
input[@type="checkbok"], and a link. The problem is that we can not have a 
sepparate label for each resource, because we already have a link (the 
link's text should be the label, but we must use an "a" tag instead of a 
"label" because we want to provide a link). and we don't want to write 
twice "resource #n" for each resource:

<input type="checkbox" id="B01" name="B01" title="Book resource #1" />
<a class="label" href="bookings1.html" title="Resource #1's 
bookings">Resource #1</a>

Saying something like: <input/> <a/> <label/> would not be acceptable. 
Focusable elements like "label" and "a" must not nest either. I have used 
a class="label" for the link instead, but there is no real label.

In this case, WCAG says that a "title" attribute is an acceptable 
description for every form field that can not have a label.

So my real XQuery expressions are:

//input[@type = "radio"][not(@type)][let $ff:=self::node() return
  count(//label[@for=$ff/@id]) != 1] = ()

//input[@type = "checkbox"][not(@type)][let $ff:=self::node() return
  count(//label[@for=$ff/@id]) != 1] = ()

//select[not(@type)][let $ff:=self::node() return
  count(//label[@for=$ff/@id]) != 1] = ()

...

Opinions?

Vicente Luque Centeno
Dep. Ingeniería Telemática
Universidad Carlos III de Madrid
http://www.it.uc3m.es/vlc

On Mon, 4 Jul 2005, Chris Ridpath wrote:

> Right. Every select element must have one explicitly associated label.
>
> Chris
>
> ----- Original Message ----- From: "Vicente Luque Centeno" <vlc@it.uc3m.es>
> To: <public-wai-ert@w3.org>
> Sent: Saturday, June 25, 2005 12:14 PM
> Subject: Formalization of rule 91
>
>
>
> Hi,
>
> Rule 91 [1] can be formalized saying:
>
> //select[let $ff:=self::node() return
> count(//label[@for=$ff/@id]) != 1] = ()
>
> PS: In other words, every select (which we name with a variable), must
> have one associated label, i.e., one label whose "for" attribute equals
> the "id" attribute of the select).
>
> PS2: There are over 60 formalized tests (using XPath and XQuery) at
> http://www.it.uc3m.es/vlc/wai/checks.xml .
>
> [1] http://www.w3.org/WAI/GL/WCAG20/tests/test91.html
>
> Vicente Luque Centeno
> Dep. Ingeniería Telemática
> Universidad Carlos III de Madrid
> http://www.it.uc3m.es/vlc
>
>

Received on Monday, 4 July 2005 15:17:00 UTC