<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>9547</bug_id>
          
          <creation_ts>2010-04-17 15:35:05 +0000</creation_ts>
          <short_desc>If more than one element has the autofocus attribute specified, only the first one should be focused</short_desc>
          <delta_ts>2010-10-04 13:58:05 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>pre-LC1 HTML5 spec (editor: Ian Hickson)</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://dev.w3.org/html5/spec/forms.html#attr-fe-autofocus</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mounir Lamouri">mounir</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ayg</cc>
    
    <cc>ian</cc>
    
    <cc>jonas</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>webmaster</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>35122</commentid>
    <comment_count>0</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2010-04-17 15:35:05 +0000</bug_when>
    <thetext>At the moment, the autofocus attribute specification say only one element in the document should have the autofocus attribute specified but each time an element with the autofocus attribute is inserted into the document, it should be focused following the given rules. In other words, only one element should have the autofocus attribute specified and the last one will have the autofocus applying if there are more than one.

It would be probably better to have the exact opposite behavior: only the first element with the autofocus attribute specified should have the autofocus behavior applying. For the author, having more than one element with the autofocus attribute is already wrong and for the user it would be better.
For example:
&lt;html&gt;
  &lt;body&gt;
    &lt;form&gt;
      &lt;input id=c1 autofocus&gt;
    &lt;/form&gt;
    ...lots of content here...
    &lt;form&gt;
      &lt;input id=c2 autofocus&gt;
    &lt;/form&gt;
  &lt;/body&gt;
&lt;/html&gt;
The user will have the focus on the first input element and then the second input element will be focused. This may be really annoying. The specifications already said the autofocus may be ignored if the user has began to interact with the document. This can be done by not autofocusing when an element is already focused but it&apos;s would be a violation of the current specifications.

The change could be made in two ways:
- only the first focusable element with autofocus specified should be focused, or
- the autofocus attribute apply only if there is no focused element in the document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37516</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-08-16 22:15:19 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: More or less as requested.
Rationale: This was addressed as part of some e-mailed feedback recently.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>