W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2008

[whatwg] Placeholder option for text input boxes

From: Russell Leggett <russell.leggett@gmail.com>
Date: Fri, 3 Oct 2008 10:06:11 -0400
Message-ID: <680cacd10810030706hf1eb55i15358e0ecc89224b@mail.gmail.com>
I've wrestled with this because its something that our designer has wanted
to use all over the place for an application I'm working on. It turns out to
be a usability nightmare if not used sparingly. When we used it, it was
definitely in place of an actual label, and I think this would be true in
most cases. In the cases where an outer label and a placeholder are needed,
I think the solution could just be to have two Label elements that point to
the same input.
>From the HTML 4.01
spec<http://www.w3.org/TR/html4/interact/forms.html#edef-LABEL>
 :

> More than one LABEL<http://www.w3.org/TR/html4/interact/forms.html#edef-LABEL> may
> be associated with the same control by creating multiple references via the
> for <http://www.w3.org/TR/html4/interact/forms.html#adef-for> attribute.
>

Then CSS could be used on one of the labels to make it appear as placeholder
content.

On Thu, Oct 2, 2008 at 7:34 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:

> On Thu, Oct 2, 2008 at 6:27 PM, Brenton Strine <Brenton.Strine at citrix.com>wrote:
>
>> On Tue, Sep 30, 2008 at 11:36 AM, Andy Lyttle <whatwg at phroggy.com> wrote:
>> [snip]
>> > 4) <label> (moving label textual content into <input> as placeholder
>> text; currently with Javascript to mutate the DOM, in the > future with CSS
>> to present the desired appearance while keeping the DOM stable)
>> >  Pro: Most semantic.
>> [snip]
>>
>> That depends on what you are using it for. What if you are using it to
>> apply a placeholder that says "(optional)"? That is not a label at all.
>> There are a lot of uses for the proposed placeholder attribute that just
>> don't fit into any of the other categories. I think a placeholder attribute
>> would be great.
>
>
> Hmm, true.  That's definitely a case where the text can't be argued to be a
> label.
>
> Of course, it's still not in any way semantic.  The only difference between
> "(optional)" being displayed near the input and being displayed *within* the
> input is one of aesthetics.   The meaning of the document isn't changed one
> iota.  This leans me even more toward a CSS solution.  I'll just bite the
> bullet and bring it up to the CSS WG.
>
> ~TJ
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20081003/17e6ba17/attachment.htm>
Received on Friday, 3 October 2008 07:06:11 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:06 UTC