This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 9651 - autofocus should not work if the focused document is a sub-document
Summary: autofocus should not work if the focused document is a sub-document
Status: RESOLVED WORKSFORME
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-03 23:22 UTC by Mounir Lamouri
Modified: 2010-10-04 14:49 UTC (History)
6 users (show)

See Also:


Attachments

Description Mounir Lamouri 2010-05-03 23:22:43 UTC
If we have:
<html>
<body>
<iframe src="somewhere"></iframe>
<input autofocus>
</body>
</html>

If the user is interacting with the iframe before the autofocus event is called for the input, the input shouldn't be focus.
In other words, when the focused document is a sub-document, if an element from the parent document wants to focus via autofocus it shouldn't have it.
Comment 1 Lachlan Hunt 2010-05-06 13:55:56 UTC
The spec already defines:

"User agents may ignore this attribute if the user has indicated (for example, by starting to type in a form control) that he does not wish focus to be changed."

What you're asking for is already permitted.  It does not matter whether the user is interacting with another control in the same document, a document in another frame or a control on the browser chrome.  The UA may ignore the autofocus in any or all of those cases.