[whatwg] The placeholder attribute

On 22 and 24 Sep 2011, Bjartur Thorlacius wrote:
>
> The semantics of the placeholder and title attributes of inputs overlap 
> slightly; the placeholder attribute may contain a hint to aid the user, 
> while title is to contain "other advisory text." I can think of two 
> valid uses of placeholder: example value, and the text "click here to 
> type" or "enter search query here." The latter is obviously user 
> interface that should be implemented by interactive user agents. Then 
> there is the third use, use it as a title attribute (but with richer 
> presentation).
>
> Users might want values falling under the first to be prefixed with 
> "e.g.", "for example" or equivalent - but by allowing the latter use 
> forces authors to add it to all example values, rather than letting the 
> user's style sheet take care of it. Thus I suggest narrowing the 
> semantics of the attribute to example values, allowing for easier 
> styling by users (or agents, on their behalf). The second one should 
> have no valid representation. Lastly, the specification should make it 
> clearer what the title attribute is appropriate for; a description of 
> the input or format.
> 
> Also, I see no reason to suggest not rendering the text when the input 
> is focused - in special on 1D devices such as speech - considering that 
> JavaScript dependent sites (such as Hotmail) have placed example values 
> in a small font below the input so that it can be visible while the user 
> is typing, and, more importantly, after the input has been focused 
> (whether automatically or manually), but before the user starts typing.
> 
> As for the argument against using the title attribute for everything 
> that it would break existing sites, I do believe rendering the title 
> attribute of an empty and unfocused input inside of it is an improvement 
> over displaying a tooltip a second or two after the user positions a 
> cursor over the input (irrespective of focus). How on Earth is anyone to 
> think of doing that? Displaying the title attribute in a floating box in 
> a margin when an input is focused, followed by the example value 
> prefixed with "e.g." would be my preferred rendering, but that's just my 
> opinion.

> Should @placeholder be renamed @eg, and used exclusively for example 
> input?

I think you're overthinking it. :-)

In theory, the main differences between title="" and placeholder="" is 
that title="" can be longer and would be shown on request, while 
placeholder="" is shorter, shown as part of the input feature, typically 
only when there's no input already, and would be specifically about the 
input format.

In practice, on visual media, this means title="" is a tooltip and 
placeholder="" is an inline caption.


> P.S. The last paragraph of the section on the pattern attribute links 
> twice to <semantics.html#the-title-element>. Should it not link to 
> <elements.html#the-title-attribute>?

Fixed, thanks.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Wednesday, 25 January 2012 16:07:19 UTC