WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: label element containing input element

for

Number of posts in this thread: 3 (In chronological order)

From: Dey Alexander
Date: Thu, Nov 06 2003 2:36AM
Subject: label element containing input element
No previous message | Next message →

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 ADDRESS 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/


From: Terence de Giere
Date: Fri, Nov 07 2003 2:45PM
Subject: RE: label element containing input element
← Previous message | Next message →

Enclosing the input element in the label element is 'implicit
association' of the label with the form control. It also allows certain
visual format effects using cascading style sheets, such as indicating
the label and the control are a single unit and go together, but some
browsers do not support this construction properly which may be why
screen readers are not handling this correctly. It probably is better to
keep the label separate from the control until the problem software is
sufficiently obsolete. Strictly speaking, the text in any element
between the start and end tags should be rendered by an HTML compliant
agent, whether or not the element is supported by the agent.

Terence de Giere
= EMAIL ADDRESS REMOVED =



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


From: Tim Harshbarger
Date: Thu, Nov 06 2003 6:28AM
Subject: RE: label element containing input element
← Previous message | No next message

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 ADDRESS REMOVED =
>[mailto: = EMAIL ADDRESS REMOVED = ]
>Sent: Thursday, November 06, 2003 3:31 AM
>To: = EMAIL ADDRESS 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 ADDRESS 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/