[whatwg] Two propositions for the autofocus attribute

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