RE: Proper Coding for Yes/No Questions

Well,

it is true that it would be nice if access technology better supported things
specifically designed to help it. But developers don't seem to have time to
do everything one would wish immmediately, and each chooses their own
priorities. (Presumably acording to customer feedback.)

The future of forms in XML (Xforms - http://www.w3.org/TR/xforms for the
interested) recognises that the difference between a select box (pull-down
menu) and a set of radio buttons, and a slider, for that matter, is really
just one of presentation - structurally they are doing the same thing (asking
the user to pick one from a number of options).

But it seems that the legend element is not doing much harm, and it is handy
at least  for visual users, so I would recommend people keep using it, along
with fieldsets and labels, if they have some overwhelming need for radio
buttons instead of select boxes.

Note that there is a very commmon problem for users of IE and JAWS, that the
typical navigation mechanism for using select boxes isn't in fact the one
recommended, since it triggers the onChange event when javasccript is active.
Instead of discovering that there is a special method of working with select
boxes, most users seem to get frustrateed and either turnn off javascript or
rearrange their bookmarks.

Cheers

Charles McCN

On Fri, 8 Mar 2002, Mike Scott wrote:

  Unfortunately, neither JAWS (4.01 or 4.02 beta) or Home Page Reader 3.02
  associate legend with radio button controls...

  With JAWS, if you "tab" into a radio button group labeled with a legend,
  you don't hear the "question" (i.e. legend). If you simply place the
  "question" text (in a paragraph, etc) before the series of radio
  buttons, JAWS (4.01+) does a *reasonably* good job guessing what text to
  associate, and will re-read it before each radio button (e.g. "Are you
  smart? Radio button Yes, Are you smart? Radio button No.", which is
  JAWS' behavior with standard Windows radio button controls).
  Unfortunately, it's not hard to come up with slightly more complex
  layout examples that defeat JAWS' ability to identify the "question"
  correctly.

  HPR reads the "question" (legend or otherwise) along with the first
  radio button only. It's a little better, but if there are very many
  radio buttons in the group, it's easy to forget the question, and
  difficult to re-read it.

  Until fieldset and legend are supported by assistive technologies, the
  most practical solution seems to be to use select controls instead of
  groups of radio buttons. (In an ideal world, you'd think radio buttons
  would have been a type of select anyway -- then we wouldn't need the
  name attribute to tie them together either...)

  Mike


  -----Original Message-----
  From: w3c-wai-ig-request@w3.org [mailto:w3c-wai-ig-request@w3.org] On
  Behalf Of Kynn Bartlett
  Sent: Tuesday, March 05, 2002 6:21 PM
  To: RUST Randal; WAI (E-mail)
  Subject: Re: Proper Coding for Yes/No Questions

  At 11:57 AM -0500 3/5/02, RUST Randal wrote:
  >I have several forms with simple "yes/no" questions on them.  I need to

  >use radio buttons for the selections.
  >
  >Is the following code correct for accessibility?
  >
  >----------
  >
  ><label for="smart">Are you smart?</label>
  ><label for="smartYes">Yes</label><input type="radio" id="smartYes" />
  ><label for="smartNo">No</label><input type="radio" id="smartNo" />

  No, but close. You want something like this:

  <fieldset>
     <legend>Are you smart?</legend>
     <label for="smartYes">Yes</label>
     <input type="radio" id="smartYes" value="yes" name="smartYes" />
     <label for="smartNo">No</label>
     <input type="radio" id="smartNo" value="no" name="smartNo" />
  </fieldset>



-- 
Charles McCathieNevile    http://www.w3.org/People/Charles  phone: +61 409 134 136
W3C Web Accessibility Initiative     http://www.w3.org/WAI  fax: +33 4 92 38 78 22
Location: 21 Mitchell street FOOTSCRAY Vic 3011, Australia
(or W3C INRIA, Route des Lucioles, BP 93, 06902 Sophia Antipolis Cedex, France)

Received on Monday, 11 March 2002 08:19:51 UTC