W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2007

[whatwg] [WF2] Clear On Focus attribute

From: Anne van Kesteren <annevk@opera.com>
Date: Mon, 21 May 2007 17:39:20 +0200
Message-ID: <op.tsoofuxr64w2qv@annevk.hotspot.sfr.fr>
On Mon, 21 May 2007 17:35:27 +0200, Stijn Peeters <stijn.p at hccnet.nl>  
wrote:
> It is becoming increasingly common to have an input field clear its
> value when it is first focused. Though in a lot of cases this is
> actually wrong usage of the value=""  attribute for something which
> should actually be done with <label> (such as a search box filled with
> "Enter search query here" that becomes empty when you first click it),
> it is possible to come up with legitimate use cases; the first thing
> that comes to mind are input fields with placeholder or default values
> that may need to be changed. This goes well together with WF2's new
> abilities for prefilling forms.
>
> It makes sense to clear these values when the field is focused, as the
> user will probably want to insert a new value rather than edit the value
> that is currently in it. Currently this is mostly done through
> javascript, which is not necessarily a bad thing, but seeing that
> attributes such as autofocus=""  have also found their way into the
> spec, I suppose this is also inside the scope of Web Forms 2 or HTML5.
> As for the attribute name, clearonfocus="" with "clearonfocus" as the
> only possible value (indicating the input field or textarea should be
> cleared upon focusing it) would probably be most suitable.

WebKit implements a placeholder= attribute which seems more suitable for  
this purpose.


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>
Received on Monday, 21 May 2007 08:39:20 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:55 UTC