[thelist] Search Form accessibility question

Xavier Pereta xpereta at svt.es
Fri Feb 13 06:40:10 CST 2004


> 1) Explicitly associate form controls and their labels with the LABEL 
> element.
> 
> 2) Make sure that labels of all form controls are properly placed.
>
> 3) If there are logical groupings of form controls, use FIELDSET with 
> LEGEND on each group.

Here are my suggestions:

As you say the validator is complaining for the lack of the label on
your form. As you already know, something like this might do:

<form id="searchform" action="index.html" method="get">
	<p id="searchinput">
		<label for="search">Search terms</label>
		<input id="search" maxlength="255" size="10"
value="&nbsp;search" name="search">&nbsp;
		<input type="submit" value="go!">
	</p>
</form>


The problem here is that you don't really want to show (or need) the
text of the label when the page is displayed in common graphical user
agents. The function of the search box is then obvious because of its
context. In this case you either want to hide the label by means of CSS
style (which may not be appropiate), or use an empty label with the
title attribute. In this last case you are hoping that user agents that
find an empty label will at least try to tell the user the value of the
title attribute of this label.


<form id="searchform" action="index.html" method="get">
	<p id="searchinput">
		<label for="search" title="Search terms"></label>
		<input id="search" maxlength="255" size="10"
value="&nbsp;search" name="search">&nbsp;
		<input type="submit" value="go!">
	</p>
</form>


Any suggestion?

Greetings,
Xavier Pereta



More information about the thelist mailing list