W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > April to June 2004

Re: label tag question

From: Patrick H. Lauke <redux@splintered.co.uk>
Date: Wed, 23 Jun 2004 21:54:15 +0100
Message-ID: <005001c45964$41e53ac0$6401a8c0@pollux>
To: <w3c-wai-ig@w3.org>

Unless I'm mistaken - and I don't have any screenreader or similar here at
home to double-check, so if I'm way off, just shoot me down - this situation
would call for either a hidden label (e.g. a small transparent graphic or a
regular label hidden via CSS), or the use of a title on the actual input
element.

<tr>
<td>&nbsp;</td>
<th scope="col">FY04 Number</th>
<th scope="col">FY05 Number</th>
</tr>
<tr>
<th scope="row">Group 1</th>
<td><input type="text" name="fy04g1" title="FY04 Number - Group 1" /></td>
<td><input type="text" name="fy05g1" title="FY05 Number - Group 1" /></td>
</tr>

or

<tr>
<td>&nbsp;</td>
<th scope="col">FY04 Number</th>
<th scope="col">FY05 Number</th>
</tr>
<tr>
<th scope="row">Group 1</th>
<td><label for="fy04g1"><img src="trans.gif" alt="FY04 Number - Group 1"
width="1" height="1" /></label>
<input type="text" name="fy04g1" id="fy04g1" /></td>
<td><label for="fy05g1"><img src="trans.gif" alt="FY05 Number - Group 1"
width="1" height="1" /></label>
<input type="text" name="fy05g1" id="fy05g1" /></td>
</tr>

or

<tr>
<td>&nbsp;</td>
<th scope="col">FY04 Number</th>
<th scope="col">FY05 Number</th>
</tr>
<tr>
<th scope="row">Group 1</th>
<td><label for="fy04g1">FY04 Number - Group 1</label>
<input type="text" name="fy04g1" id="fy04g1" /></td>
<td><label for="fy05g1">FY05 Number - Group 1</label>
<input type="text" name="fy05g1" id="fy05g1" /></td>
</tr>

with CSS of label { display: none; } (even though reportedly screenreaders
omit
elements that are hidden this way, I seem to remember - again, shoot me if
I'm wrong -
that this is not the case with labels, as they're unequivocally referencing
the id of the
input?)

...but I'm sure there's a more elegant solution than any of the above (?)

Patrick
________________________________
Patrick H. Lauke
Webmaster / University of Salford
http://www.salford.ac.uk
Received on Wednesday, 23 June 2004 16:54:40 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:33 UTC