W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2010

[whatwg] Two propositions for the autofocus attribute

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Fri, 16 Apr 2010 15:03:09 +0200
Message-ID: <4BC8600D.4010003@lachy.id.au>
On 2010-04-16 09:30, Kit Grose wrote:
> On 16/04/2010, at 5:06 PM, Markus Ernst wrote:
>
>> Is it not possible to say the autofocus attribute is readonly? It
>> dose IMO not make sense to apply it via scripting, as focus() is
>> available for scripting.
>
> What if the form is received via XHR as HTML and simply injected to
> the page using innerHTML?

If the user has already started interacting with other controls in the 
page, like form controls, a contenteditable region or is typing into 
some control in the browser chrome (e.g. the address bar or quickfind 
textbox), the autofocus behaviour should not occur.  Otherwise, if the 
user hasn't interacted with the page, then the control should be focussed.

Personally, I also agree that it makes sense for autofocus to only apply 
to the first such control.  However, Opera's implementation currently 
works as specified in the spec, focussing the last such control that is 
inserted.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/
Received on Friday, 16 April 2010 06:03:09 UTC

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