[whatwg] Two propositions for the autofocus attribute

Kit Grose kit at iqmultimedia.com.au
Thu Apr 15 18:10:44 PDT 2010

On 16/04/2010, at 10:54 AM, Jonas Sicking wrote:
> Worse, the spec (IMHO rightly) suggests that if the user is already
> interacting with another part of the page, the autofocus attribute
> should be ignored. So in this case the 'compose' link will be focused,
> and so the UA should IMHO assume that the user is interacting with
> that link. Thus it would not focus the newly inserted form control.

Actually, you're right. I can't see any situation where this is expected behaviour if "interacting" includes scroll/link focus/keyboard events (which I can only imagine they do).

I do think if the behaviour you describe is implemented in the spec, pages with multiple elements set to autofocus should be invalid.

Hopefully if UAs implement "ignore focus requests if the user is typing" for the autofocus attribute they can extend that behaviour to the standard focus() function and it'll therefore be less user hostile to use the function on our sites.


More information about the whatwg mailing list