WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: form label question

for

From: Moore, Michael
Date: Aug 10, 2007 9:20AM


On 8/9/07, Sawang Srisom wrote:

> <label for="gender1 gender2">Gender</label> <input type="radio"
> name="gender" id="gender1" value="Male"
> checked="checked" /> Male<br />
> <input type="radio" name="gender" id="gender2" value="Female"
> checked="checked" /> Female

Jared:

In this case, "Male" and "Female" should be the labels for their
appropriate radio buttons. "Gender" should not be marked up as a label.
It could and probably should, however, be a legend for a fieldset that
surrounds the two radio buttons.

Examples and proper coding at
http://webaim.org/techniques/forms/controls.php

I think what we're all saying is that labels are necessary for
accessibility. There are few cases when they might pose design and
usability issues and in those cases, it must be visually and
programmatically (through title, row/column headers, etc.) apparent what
the function of the form element is.

Mike's response:

Try testing this

<span class="question">Gender</span>
<div class="radioInput"><input type="radio" name="gender" id="gender1"
value="Male" />
<label for="gender1"><img src="hidden.gif" alt="gender" height="1"
width="1">Male</label></div>
<div class="radioInput"><input type="radio" name="gender" id="gender2"
value="Female" />
<label for="gender2">Female</label></div>

You will need to create your own styles for the classes, and a 1px clear
gif.

This method has now been tested with JAWS 6, JAWS 7, and JAWS 8. Window
Eyes testing to be done early next week. It has the following advantages
over fieldsets/legends:

1. Better formatting of questions over the use of fieldsets/legends,
particularly for long questions.
2. Better reporting of questions by JAWS over the use of fieldsets. The
jury is still out on Window Eyes but I don't see why it wouldn't work.
Overriding reading of fieldset legends does not result in no reading of
the questions.
3. Better usability for JAWS users because the do not have to listen to
the question again for each answer selection. This assessment is based
upon feedback from several dozen JAWS users and complaints about JAWS
rereading questions placed in fieldset labels from an even larger set of
users.

I would appreciate it if someone could provide results of testing with
other screen readers.

Mike