WebAIM - Web Accessibility In Mind

E-mail List Archives

RE: label element containing input element

for

From: Tim Harshbarger
Date: Nov 6, 2003 6:28AM


Dey,

I came across this potential contradiction as well. Basically, I think it
might be a difference between specifications and reality.

I believe in both the HTML 4.01 and XHTML 1.0 specs, it states that you can
place the input element inside the label element. However, whenever I have
tested this on the browsers I use with the screen readers I use, it does not
work. Of course, it could also be that there are other assistive
technologies or browsers which support this -- and I just do not know which
ones they are.

I expect that someone will mention that this has to do with poor browser
implementation of the specs -- and it would be great if user agents did
fully implment what is in the specs. However, from a practical "I've gotta
make it work today" aspect, I just rely on using the label element along
with the for and id attributes to establish explicit relationships between
labels and forms controls -- that is when it is not a group label or I find
myself in one of those situations where the label element just does not
quite get the job done.

Tim

>-----Original Message-----
>From: <EMAIL REMOVED>
>[mailto: <EMAIL REMOVED> ]
>Sent: Thursday, November 06, 2003 3:31 AM
>To: <EMAIL REMOVED>
>Subject: label element containing input element
>
>
>Hi folks,
>
>Just a quickie regarding the use of the label element in conjunction
>with the input element, in particular, the results of containing the
>latter within the former.
>
>I note that at the following advice is given on the W3C's
>wai-ig list at
>http://lists.w3.org/Archives/Public/w3c-wai-ig/2002AprJun/0131.html
>
> > Jim Thatcher at <EMAIL REMOVED> wrote:
> > If you use LABEL as a container for the INPUT element as
>well > as the text, then screen readers will ignore it. So
>don't do > that.
>
>And yet contradictory advice is given at
>http://www.accessifyforum.com/viewtopic.php?t=100 and
>http://lists.w3.org/Archives/Public/w3c-wai-ig/2002JanMar/1227.
html (and
elsewhere, but I don't want to weigh you down with URLs). These suggest
the label element can (should?) enclose the input element.

Any comments on which is the preferred approach and why?

Cheers,
Dey


----
To subscribe, unsubscribe, suspend, or view list archives,
visit http://www.webaim.org/discussion/


----
To subscribe, unsubscribe, suspend, or view list archives,
visit http://www.webaim.org/discussion/