[whatwg] Two propositions for the autofocus attribute

Garrett Smith dhtmlkitchen at gmail.com
Mon Apr 26 13:32:49 PDT 2010

On Mon, Apr 26, 2010 at 1:54 AM, timeless <timeless at gmail.com> wrote:
> On Mon, Apr 26, 2010 at 2:14 AM, Garrett Smith <dhtmlkitchen at gmail.com> wrote:
>>> we had a "manager" who insisted on a "feature" where the browser would
>>> move focus to the urlbar in certain cases.

>> Maybe his typing is also slow or maybe he doesn't use the feature repeatedly/
> on most static pages, his intended behavior is arguably useful.
> (his claim was "if nothing is focussed, and the url bar isn't visible,
> then typing should jump to the urlbar, so that i can easily type
> 'google.com'.)

No accesskeys or tabbing?


>> Sure, and that code would surely e a mistake; perhaps using two
>> separate include files. The developer adding the second might wonder:
>> Why does c2 not get focus? He would find his mistake, eventually
>> (hopefully soon!) and fix it.
> developers are unlikely to find such mistakes because they're likely
> to have very fast computers with very short links to their servers.
> users otoh tend to have slow computers with long and slow links to the
> real servers.
> besides, i believe we've established that c2 would get focus (unless
> there's a user involved), so that developer wouldn't notice a problem
> at all.
Yes, that was established. The problem is that c2 gets focus; the
developer won't notice that; but the user on the slow wifi connection
will get a very bad experience when the focus is shifting

I can easily see such problem being created on a project where a page
happens to have two features with autofocus, uses multiple includes,
and has different developers working on separate features.

The proposed behavior would help eliminate problems like that because
when a second autofocus is added, it won't get autofocused. The
developer should then notice that his autofocus did not work and
problem should be more obvious. My comments were an argument to
justify the proposed change.

Considering a case where a page contains an iframe, the iframe's
content is replaced entirely:-

iframeDoc.body.innerHTML = "<div><input autofocus type='text'><\/div>";

- should the input get autofocus or not?

What other edge cases are there?

(I still think its a bad feature).


More information about the whatwg mailing list