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

[whatwg] Two propositions for the autofocus attribute

From: Markus Ernst <derernst@gmx.ch>
Date: Fri, 16 Apr 2010 09:06:07 +0200
Message-ID: <4BC80C5F.20007@gmx.ch>
Am 16.04.2010 02:44 schrieb Kit Grose:
> On 16/04/2010, at 9:08 AM, Jonas Sicking wrote:
> 
>> While we could deploy a bunch of heuristics, it seems much simpler to
>> just say that it is the *first* element with autofocus that should
>> receive focus. I can't think of any significant downsides with this.
> 
> I agree with you both generally, but I disagree that there are no downsides. I imagine the main use-case where this sort of behaviour might be expected is a Javascript application which dynamically adds a new form to the page based on some user interaction and one of those fields should be autofocused when it's been added to the DOM.
> 
> For instance, picture the Gmail model. When you first load, the autofocus attribute could conceivably be on the inbox search field. When you click Compose, the compose form will be dynamically added and the "To" field should be autofocused (but the search field is still on-screen)

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.
Received on Friday, 16 April 2010 00:06:07 UTC

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