W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > August 2010

[Bug 9602] Autofocus attribute.

From: <bugzilla@jessica.w3.org>
Date: Thu, 05 Aug 2010 18:39:00 +0000
To: public-html-bugzilla@w3.org
Message-Id: <E1Oh5LI-0001AI-LP@jessica.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=9602





--- Comment #17 from Aryeh Gregor <Simetrical+w3cbug@gmail.com>  2010-08-05 18:38:58 ---
(In reply to comment #10)
> I think that argument goes both ways. Who needs to autofocus something? Google?
> I mean; what is it use, if the same can be accomplished by JavaScript too? 

Because getting autofocus right with JavaScript is somewhat tricky.  You have
to do it in a script that executes right after the input loads, so that it
focuses right away and doesn't steal focus when the user has explicitly changed
it.  Doing it on a <body onload> is common but broken.  Similarly, you have to
only do it if the user hasn't already focused something else.  And you have to
make sure not to do the focusing on any element you want to autofocus beyond
the first.  This is all perfectly possible to do in JavaScript, but it's
error-prone.  Since the need is so common, it makes sense to have simpler
markup to permit it.

Also, this way users who dislike autofocus can disable it in their browser
programmatically.  This isn't possible if the autofocus is done by JavaScript,
without disabling all focus() (which is overkill).

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Thursday, 5 August 2010 18:39:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 20:01:21 UTC