WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: Do you need to have a label on a form field when it has a default value?

for

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

From: Dean Hamack
Date: Thu, Sep 09 2010 3:14PM
Subject: Do you need to have a label on a form field when it has a default value?
No previous message | Next message →

Building a form, and the design specs show a form field with the
instructions for what to enter right in the field, like so:

<input name="mobile" type="text" value="Enter a 10 digit T-Mobile Number" />

Is a label really necessary here? It seems redundant to me.

From: Jukka K. Korpela
Date: Thu, Sep 09 2010 10:42PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

Dean Hamack wrote:

> Building a form, and the design specs show a form field with the
> instructions for what to enter right in the field, like so:
>
> <input name="mobile" type="text" value="Enter a 10 digit T-Mobile
> Number" />
>
> Is a label really necessary here? It seems redundant to me.

It is not necessary, it is harmful to accessibility and usability. Any
instructions that are needed should be given in the page content, preferably
before the field and its label, or as available by following a link.

(I suppose the form is for some technical context for people who know what
"T-Mobile Number" means.)

--
Yucca, http://www.cs.tut.fi/~jkorpela/

From: Jukka K. Korpela
Date: Thu, Sep 09 2010 10:57PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

Dean Hamack wrote:

> Building a form, and the design specs show a form field with the
> instructions for what to enter right in the field, like so:
>
> <input name="mobile" type="text" value="Enter a 10 digit T-Mobile
> Number" />
>
> Is a label really necessary here? It seems redundant to me.

It is not necessary, it is harmful to accessibility and usability. Any
instructions that are needed should be given in the page content, preferably
before the field and its label, or as available by following a link.

(I suppose the form is for some technical context for people who know what
"T-Mobile Number" means.)

--
Yucca, http://www.cs.tut.fi/~jkorpela/

From: Jukka K. Korpela
Date: Thu, Sep 09 2010 11:18PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

Dean Hamack wrote:

> Building a form, and the design specs show a form field with the
> instructions for what to enter right in the field, like so:
>
> <input name="mobile" type="text" value="Enter a 10 digit T-Mobile
> Number" />
>
> Is a label really necessary here? It seems redundant to me.

It is not necessary, it is harmful to accessibility and usability. Any
instructions that are needed should be given in the page content, preferably
before the field and its label, or as available by following a link.

(I suppose the form is for some technical context for people who know what
"T-Mobile Number" means.)

--
Yucca, http://www.cs.tut.fi/~jkorpela/

From: Terrill Bennett
Date: Fri, Sep 10 2010 9:45AM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

So I enter the field and here "Enter a 10 digit T-Mobile Number."
Excellent, I can do that!

I enter: 1234567890

I move to another field (forward or backward in the form).

I come back to that field and here "1234567890"

Hmmm... what's this field for? It sounds like my T-Mobile phone
number, but is that what I was supposed to put in there? I don't
know, for sure.

I vote "Label the field properly."

As we all know: "Practice Makes Permanent" and "Perfect Practice
Makes Perfect." Once you go down the Dark Side, you will convince
yourself it's a good practice.

-- Terrill --

=======================From: Dean Hamack
Date: Sep 9, 2010 3:14PM

Building a form, and the design specs show a form field with the
instructions for what to enter right in the field, like so:

<input name="mobile" type="text" value="Enter a 10 digit T-Mobile Number" />

Is a label really necessary here? It seems redundant to me.

From: adam solomon
Date: Sat, Sep 11 2010 12:06PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

Labels are always advisable, but not required. Where a label is not desired
by the developer, WCAG indicates that a title attribute will suffice in its
stead. One or the other, at the very least.

On Fri, Sep 10, 2010 at 6:43 PM, Terrill Bennett <
= EMAIL ADDRESS REMOVED = > wrote:

> So I enter the field and here "Enter a 10 digit T-Mobile Number."
> Excellent, I can do that!
>
> I enter: 1234567890
>
> I move to another field (forward or backward in the form).
>
> I come back to that field and here "1234567890"
>
> Hmmm... what's this field for? It sounds like my T-Mobile phone
> number, but is that what I was supposed to put in there? I don't
> know, for sure.
>
> I vote "Label the field properly."
>
> As we all know: "Practice Makes Permanent" and "Perfect Practice
> Makes Perfect." Once you go down the Dark Side, you will convince
> yourself it's a good practice.
>
> -- Terrill --
>
> =======================> From: Dean Hamack
> Date: Sep 9, 2010 3:14PM
>
> Building a form, and the design specs show a form field with the
> instructions for what to enter right in the field, like so:
>
> <input name="mobile" type="text" value="Enter a 10 digit T-Mobile Number"
> />
>
> Is a label really necessary here? It seems redundant to me.
>

From: Susan Grossman
Date: Sat, Sep 11 2010 2:18PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

On Sat, Sep 11, 2010 at 11:05 AM, adam solomon < = EMAIL ADDRESS REMOVED =
> wrote:

> Labels are always advisable, but not required. Where a label is not
> desired
> by the developer, WCAG indicates that a title attribute will suffice in its
> stead. One or the other, at the very least.
>


Thanks everyone. Just wanted to make sure i wasn't introducing different
issues.

Susan


>
> On Fri, Sep 10, 2010 at 6:43 PM, Terrill Bennett <
> = EMAIL ADDRESS REMOVED = > wrote:
>
> > So I enter the field and here "Enter a 10 digit T-Mobile Number."
> > Excellent, I can do that!
> >
> > I enter: 1234567890
> >
> > I move to another field (forward or backward in the form).
> >
> > I come back to that field and here "1234567890"
> >
> > Hmmm... what's this field for? It sounds like my T-Mobile phone
> > number, but is that what I was supposed to put in there? I don't
> > know, for sure.
> >
> > I vote "Label the field properly."
> >
> > As we all know: "Practice Makes Permanent" and "Perfect Practice
> > Makes Perfect." Once you go down the Dark Side, you will convince
> > yourself it's a good practice.
> >
> > -- Terrill --
> >
> > =======================> > From: Dean Hamack
> > Date: Sep 9, 2010 3:14PM
> >
> > Building a form, and the design specs show a form field with the
> > instructions for what to enter right in the field, like so:
> >
> > <input name="mobile" type="text" value="Enter a 10 digit T-Mobile Number"
> > />
> >
> > Is a label really necessary here? It seems redundant to me.
> >

From: Jukka K. Korpela
Date: Sat, Sep 11 2010 2:33PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

adam solomon wrote:

> Labels are always advisable, but not required.

Depends on your definition for "required" and "always". An input field
should always have a label, for accessibility. (What some "accessibility
recommendations" say is a different issue, bu they generally agree.) For a
submit button, a label is seldom needed, or useful.

> Where a label is not desired by the developer,

Why would the desired of a developer matter?

> WCAG indicates that a title attribute will
> suffice in its stead.

If it says so, and I cannot see where it does, it is simply bad advice. The
title attribute is by definition an optional advisory title, and in
practice, only a small fraction of users will ever notice its presence.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

From: William Lawrence
Date: Sun, Sep 12 2010 2:57PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

Default text in the value attribute implicitly labels the form input.
Form input elements must always be explicitly labeled, either with a
label element or with the title attribute of the input element.


Cheers!,
William
--
William Lawrence
Accessibility Engineer



On Sat, Sep 11, 2010 at 4:28 PM, Jukka K. Korpela < = EMAIL ADDRESS REMOVED = > wrote:
> adam solomon wrote:
>
>> Labels are always advisable, but not required.
>
> Depends on your definition for "required" and "always". An input field
> should always have a label, for accessibility. (What some "accessibility
> recommendations" say is a different issue, bu they generally agree.) For a
> submit button, a label is seldom needed, or useful.
>
>> Where  a label is not desired by the developer,
>
> Why would the desired of a developer matter?
>
>> WCAG indicates that a title attribute will
>> suffice in its stead.
>
> If it says so, and I cannot see where it does, it is simply bad advice. The
> title attribute is by definition an optional advisory title, and in
> practice, only a small fraction of users will ever notice its presence.
>
> --
> Yucca, http://www.cs.tut.fi/~jkorpela/
>
>

From: Jukka K. Korpela
Date: Mon, Sep 13 2010 10:30AM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

William Lawrence wrote:

> Default text in the value attribute implicitly labels the form input.

No, it explicitly fills the input field with data that should be acceptable
as actual input by many, or most, users. A typical example is prefilling a
field with a person's name if it can be retrieved from a database on the
basis of previous user actions.

Using the initial (default) content for "labelling" or "clues" is just all
wrong. Some accessibility-oriented people still believe in the grossly
outdated (and, actually, even initially wrong) accessibility recommendations
that say that all fields should have nonempty initial content. It's just as
mad as it sounds, or actually worse.

> Form input elements must always be explicitly labeled, either with a
> label element or with the title attribute of the input element.

That's just further confusion and has nothing to do with "default text".

Every input field, except usually submit buttons (which explain themselves,
or should do that), should have an explanatory label text before them. Using
<label> markup is good but less crucial. And title attributes just tend to
confuse people, especially if authors mistakenly use them _instead of_
proper labeling.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

From: adam solomon
Date: Mon, Sep 13 2010 12:03PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

I think we are talking about WCAG here, and you must have a label markup or
a title attribute. Yes, it is crucial. That is the accepted standard. It is
needed at the very least for screen readers. There is no greater confusion
for screen readers than a lack of appropriate markup.

On Mon, Sep 13, 2010 at 6:28 PM, Jukka K. Korpela < = EMAIL ADDRESS REMOVED = >wrote:

> William Lawrence wrote:
>
> > Default text in the value attribute implicitly labels the form input.
>
> No, it explicitly fills the input field with data that should be acceptable
> as actual input by many, or most, users. A typical example is prefilling a
> field with a person's name if it can be retrieved from a database on the
> basis of previous user actions.
>
> Using the initial (default) content for "labelling" or "clues" is just all
> wrong. Some accessibility-oriented people still believe in the grossly
> outdated (and, actually, even initially wrong) accessibility
> recommendations
> that say that all fields should have nonempty initial content. It's just as
> mad as it sounds, or actually worse.
>
> > Form input elements must always be explicitly labeled, either with a
> > label element or with the title attribute of the input element.
>
> That's just further confusion and has nothing to do with "default text".
>
> Every input field, except usually submit buttons (which explain themselves,
> or should do that), should have an explanatory label text before them.
> Using
> <label> markup is good but less crucial. And title attributes just tend to
> confuse people, especially if authors mistakenly use them _instead of_
> proper labeling.
>
> --
> Yucca, http://www.cs.tut.fi/~jkorpela/ <http://www.cs.tut.fi/%7Ejkorpela/>;
>
>

From: Jukka K. Korpela
Date: Mon, Sep 13 2010 1:18PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

adam solomon wrote:

> I think we are talking about WCAG here,

You are? Which "WCAG"? Anyway, what matters is accessibility, not some
compilation of recommendations.

> and you must have a label markup or a title attribute.

You are not citing an item in "WCAG", and you are not saying why it would
matter.

> Yes, it is crucial. That is the accepted standard.

No it isn't. Standards are issued by standards bodies.

> It is needed at the very least for screen readers.

No it isn't. Screen readers do just fine if you have text describing the
input field before the field. If they don't, the screen reader, rather than
the document, should be regarded as faulty.

> On Mon, Sep 13, 2010 at 6:28 PM, Jukka K. Korpela
> < = EMAIL ADDRESS REMOVED = >wrote:

Upside-down fullquoting in public discussions is a usual way of indicating
that you did not comprehensively read the text that you quote
comprehensively. This was no exception.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

From: Patrick H. Lauke
Date: Mon, Sep 13 2010 1:36PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

On 13/09/2010 20:15, Jukka K. Korpela wrote:
>> It is needed at the very least for screen readers.
>
> No it isn't. Screen readers do just fine if you have text describing the
> input field before the field. If they don't, the screen reader, rather than
> the document, should be regarded as faulty.

Just to jump in here: you are talking about the heuristics that screen
readers use to guess what text refers to an input without any explicit
label associated with it. All screenreaders handle proper labels
unambiguously (and then the label text, if need be, can be placed
before/after/anywhere...which depending on layout may be necessary). Why
propose not to use label markup and rely on heuristics?

P
--
Patrick H. Lauke

From: William Lawrence
Date: Mon, Sep 13 2010 5:06PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

On Mon, Sep 13, 2010 at 12:28 PM, Jukka K. Korpela < = EMAIL ADDRESS REMOVED = > wrote:
> That's just further confusion and has nothing to do with "default text".

Often, place-holding text, or default values, is added to form fields
because it is believed to be an accessibility requirement of Section
508, or other legacy accessibility guidelines. This used to be the
case when widely used assistive technology could not support empty
form controls correctly. Most of the time place-holding text is used
in place of appropriately labeling form controls explicitly when
trying to meet restrictive and limiting design requirements.

It is a best practice to never use place-holding characters in edit
boxes and text areas by default unless the text is included after
processing the user’s input, the semantics of the document naturally
would include such characters, or the characters were previously
entered by the user, e.g., in the case of refining a previous search.

In the event that the place-holder text is to be used, then it must
disappear when focus is achieved in that form control element that is
not device dependant.

From: Iza Bartosiewicz
Date: Tue, Sep 14 2010 9:06PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

>>> "Jukka K. Korpela" < = EMAIL ADDRESS REMOVED = > 12/09/10 6:28 >>> wrote:

>> adam solomon wrote: WCAG indicates that a title attribute will suffice in its stead.

>If it says so, and I cannot see where it does, it is simply bad advice. The
title attribute is by definition an optional advisory title, and in
practice, only a small fraction of users will ever notice its presence.

Here's the WCAG 2.0 technique:

H65: Using the title attribute to identify form controls when the label element cannot be used (HTML)
http://www.w3.org/TR/2008/WD-WCAG20-TECHS-20080430/H65.html

"The objective of this technique is to use the title attribute to label form controls when the visual design cannot accommodate the label (for example, if there is no text on the screen that can be identified as a label) or where it might be confusing to display a label. User agents, including assistive technology, can speak the title attribute."

My first choice would be to see if the design could be changed to accommodate a properly marked-up label; I would only use the title attribute as a last resort, and in preference to the variety of other approaches conveniently covered by Gez Lemon here http://juicystudio.com/article/invisible-form-prompts.php.

>and in practice, only a small fraction of users will ever notice its presence.

Are you referring to using the title attribute in general or using it specifically with form elements?

From what I've read, most of the recent versions of screen readers support title attribute on form controls, and the results from the Paciello group's 2005 test show that even older versions of the two most common screen readers supported it fairly well: http://www.paciellogroup.com/resources/articles/WE05/forms.html

If anyone is still confused about this, I'd like to recommend Roger Hudson's 'Accessible Forms using WCAG 2.0' for a thorough, practical and sensible advice on forms and accessibility: http://www.usability.com.au/resources/wcag2/

cheers

Iza Bartosiewicz

From: Jukka K. Korpela
Date: Fri, Sep 17 2010 2:27PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

William Lawrence wrote:

> It is a best practice to never use place-holding characters in edit
> boxes and text areas by default unless the text is included after
> processing the user’s input, the semantics of the document naturally
> would include such characters, or the characters were previously
> entered by the user, e.g., in the case of refining a previous search.

Well, I guess the point is that "place-holding characters" should never be
used, but a form field might, and often should, be initialized to a
meaningful default value that is suitable to a large number (typically,
majority) of users. The logic of such initialization may vary. It may depend
on user data, or it may depend on external factors, like defaulting a date
field to current date when that makes sense.

> In the event that the place-holder text is to be used, then it must
> disappear when focus is achieved in that form control element that is
> not device dependant.

I wonder how that would be accomplished. If you clear (reset to empty
string) a field when focused on, then you will also destroy actual user
input when the user enters some data, proceeds to another field, and then
returns to a previous field for whatever reason.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

From: Jukka K. Korpela
Date: Fri, Sep 17 2010 2:48PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | Next message →

Iza Bartosiewicz wrote:

> H65: Using the title attribute to identify form controls when the
> label element cannot be used (HTML)
> http://www.w3.org/TR/2008/WD-WCAG20-TECHS-20080430/H65.html

"Cannot be used" is obscure here and often just means "the visual dee-ziners
won't allow it". I'd rather suggest solving that problem than using
contrived markup that may, or may not, help some users to get over the
problem.

>> and in practice, only a small fraction of users will ever notice its
>> presence.
>
> Are you referring to using the title attribute in general or using it
> specifically with form elements?

Both.

> From what I've read, most of the recent versions of screen readers
> support title attribute on form controls,

Screen reader users as a whole constitute a small fraction of all users.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

From: Jared Smith
Date: Fri, Sep 17 2010 3:00PM
Subject: Re: Do you need to have a label on a form field when it has a default value?
← Previous message | No next message

On Fri, Sep 17, 2010 at 2:26 PM, Jukka K. Korpela wrote:

>> In the event that the place-holder text is to be used, then it must
>> disappear when focus is achieved in that form control element that is
>> not device dependant.
>
> I wonder how that would be accomplished. If you clear (reset to empty
> string) a field when focused on, then you will also destroy actual user
> input when the user enters some data, proceeds to another field, and then
> returns to a previous field for whatever reason.

It can be managed via scripting, though it is often done quite poorly.

1. Write the default value on page load using JavaScript. Do not
initiate a default value using the input's value attribute otherwise
you'll end up with the issues identified in this thread if the user
has JavaScript disabled.
2. When focus is set to the input, remove the default text (set it's
value to "") so long as it has not been modified. If the user has
entered anything into the field or if the browser, add-on, etc. has
entered any content, never clear or modify it.

I think it's also useful to redisplay the default text if the user
leaves the input (onblur) and the field is empty (the user has not
entered anything). It's also a good idea to have a validation
mechanism that ensures that the default text is not assumed to be
user-entered (for example, you can be pretty assured that the user's
name is not "Enter your name").

You can see an example of this in action at http://wave.webaim.org/
You'll also note that we change the styling of the input text slightly
to better differentiate default text from user-entered text.

Jared Smith
WebAIM