<?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>26725</bug_id>
          
          <creation_ts>2014-09-03 18:20:35 +0000</creation_ts>
          <short_desc>make element.focus() consider body element&apos;s focusable state for improved real-world interop</short_desc>
          <delta_ts>2016-04-27 22:18:44 +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>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Travis Leithead [MSFT]">travil</reporter>
          <assigned_to name="This bug has no owner yet - up for the taking">dave.null</assigned_to>
          <cc>arronei</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</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>110922</commentid>
    <comment_count>0</comment_count>
      <attachid>1508</attachid>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2014-09-03 18:20:35 +0000</bug_when>
    <thetext>Created attachment 1508
Example showing the expectations of the new behavior; this is the primary repro file.

A few months ago, IE made a platform change to improve our Mobile interop to match a webkit behavior which a variety of sites required in order to display properly. The change involved the behavior of focusing the body element. IE [previously], Firefox, and the spec all define the behavior that when element.focus() is called on the body element, it forwards the focus command on to the window which causes the viewport to be in a focused state (this scenario is usually done from a parent browsing context calling focus() on the body element of a child browsing context). However, in Webkit-based browsers, the ability of the body/viewport to accept focus is conditional on whether the body element can actually accept focus (e.g., if the body element has a valid tabindex attribute set). So, in a webkit-based browser and now in IE (on mobile, soon to come to desktop) unless the body element is focusable the call to focus() the body will do nothing.

I recommend updating the spec to contain this condition in order to better match an interoperable pattern that many [mobile] sites expect. The change would be from:

&gt; Section: Focus management APIs
&gt;  element . focus()
&gt;   Moves the focus to the element.
&gt;   If the element is the body element, moves the focus to the viewport instead.

to:

&gt; Section: Focus management APIs
&gt;  element . focus()
&gt;   Moves the focus to the element.
&gt;   If the element is the body element, and the body element is focusable, moves the focus to the viewport instead. Otherwise, does nothing.

(and update the relevant details in the algorithm for the &quot;focusing steps&quot;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110923</commentid>
    <comment_count>1</comment_count>
      <attachid>1509</attachid>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2014-09-03 18:21:49 +0000</bug_when>
    <thetext>Created attachment 1509
Supporting Iframe (needed for the repro)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121048</commentid>
    <comment_count>2</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2015-06-16 10:22:29 +0000</bug_when>
    <thetext>Making this a higher priority to actively seek more feedback on from implementers and webdevs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126238</commentid>
    <comment_count>3</comment_count>
    <who name="Arron Eicholz">arronei</who>
    <bug_when>2016-04-27 22:18:44 +0000</bug_when>
    <thetext>HTML5.1 Bugzilla Bug Triage: Moved to Github issue: https://github.com/w3c/html/issues/290

To file additional issues please use the W3C HTML5 Issue tracker: https://github.com/w3c/html/issues/new Thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1508</attachid>
            <date>2014-09-03 18:20:35 +0000</date>
            <delta_ts>2014-09-03 18:20:35 +0000</delta_ts>
            <desc>Example showing the expectations of the new behavior; this is the primary repro file.</desc>
            <filename>focus_issues.htm</filename>
            <type>text/html</type>
            <size>597</size>
            <attacher name="Travis Leithead [MSFT]">travil</attacher>
            
              <data encoding="base64">PCFkb2N0eXBlIGh0bWw+DQo8Ym9keT4NCjxpZnJhbWUgc3JjPSJmb2N1c19pc3N1ZXNfZnJhbWUu
aHRtIiBzdHlsZT0id2lkdGg6IDkwJTtoZWlnaHQ6MzAwcHgiPjwvaWZyYW1lPg0KPHNjcmlwdD4N
Ci8vIEhUTUw1Og0KLy8gZWxlbWVudCAuIGZvY3VzKCkNCi8vICAgTW92ZXMgdGhlIGZvY3VzIHRv
IHRoZSBlbGVtZW50Lg0KLy8gICBJZiB0aGUgZWxlbWVudCBpcyB0aGUgYm9keSBlbGVtZW50LCBt
b3ZlcyB0aGUgZm9jdXMgdG8gdGhlIHZpZXdwb3J0IGluc3RlYWQuDQoNCi8vIFRvIGJlIGludGVy
b3BlcmFibGUgd2l0aCBJRS9XZWJraXQsIHRoaXMgc2hvdWxkIGJlLi4uDQovLyAgIElmIHRoZSBl
bGVtZW50IGlzIHRoZSBib2R5IGVsZW1lbnQsIGFuZCB0aGUgYm9keSBpcyBmb2N1c2FibGUsIG1v
dmUgdGhlIGZvY3VzIHRvIHRoZSB2aWV3cG9ydCBpbnN0ZWFkLiAoaXQgb25seSBmaXJlcyBpZiBp
dCdzIGZvY3VzYWJsZSkNCg0KZnVuY3Rpb24gZmlyZU9uRm9jdXMoKSB7DQoJZnJhbWVzWzBdLmZv
Y3VzKCk7DQp9DQo8L3NjcmlwdD4NCjxidXR0b24gb25jbGljaz0iZmlyZU9uRm9jdXMoKSI+Rm9j
dXMgaWZyYW1lIHdpbmRvdzwvYnV0dG9uPg0K
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1509</attachid>
            <date>2014-09-03 18:21:49 +0000</date>
            <delta_ts>2014-09-03 18:21:49 +0000</delta_ts>
            <desc>Supporting Iframe (needed for the repro)</desc>
            <filename>focus_issues_frame.htm</filename>
            <type>text/html</type>
            <size>782</size>
            <attacher name="Travis Leithead [MSFT]">travil</attacher>
            
              <data encoding="base64">PGJvZHkgenRhYmluZGV4PTE+PCEtLSBjaGFuZ2UgdGhpcyB0byBoYXZlIGEgcHJvcGVyIHRhYmlu
ZGV4LCBhbmQgdGhlIGZvY3VzIGV2ZW50cyB3aWxsIGZpcmUgLS0+DQo8dGV4dGFyZWEgc3R5bGU9
IndpZHRoOjkwJTsgaGVpZ2h0OjI1MHB4Ij5DbGljayB0aGUgZm9jdXMgYnV0dG9uOyBleHBlY3Rl
ZCBub3RoaW5nIGhhcHBlbnMgKHNpbmNlIHRoaXMgaWZyYW1lJ3MgYm9keSBpcyBub3QgZm9jdXNh
YmxlKS4gQWRkIHRhYmluZGV4IHRvIHRoaXMgaWZyYW1lJ3MgYm9keSBhbmQgcmUtdGVzdCB0byBl
bnN1cmUgdGhlIGZvY3VzIGV2ZW50cyBmaXJlLjwvdGV4dGFyZWE+DQo8c2NyaXB0Pg0KdmFyIGxv
ZyA9IFtdOw0KZnVuY3Rpb24gdXBkYXRlKCkgew0KICAgdmFyIHQgPSBkb2N1bWVudC5xdWVyeVNl
bGVjdG9yKCJ0ZXh0YXJlYSIpOw0KICAgdC52YWx1ZSA9ICJBY3RpdmUgRWxlbWVudDogIiArIGRv
Y3VtZW50LmFjdGl2ZUVsZW1lbnQgKyAiXG4iICsgbG9nLmpvaW4oIlxuIik7DQp9DQoNCi8vIFRo
ZSBmb2xsb3dpbmcgYXJlIGJlIHNlbWFudGljYWxseSBlcXVpdmFsZW50IHRvIHJlZ2lzdGVyaW5n
IG9uIHRoZSB3aW5kb3cgZGlyZWN0bHkuDQpkb2N1bWVudC5ib2R5Lm9uZm9jdXMgPSBmdW5jdGlv
bihlKSB7IGxvZy5wdXNoKCJ3aW5kb3cgb25mb2N1cyBmaXJlZDsgdGFyZ2V0ID0gIiArIGUudGFy
Z2V0KTsgdXBkYXRlKCk7IH0NCjwvc2NyaXB0Pg0KPGJ1dHRvbiBvbmNsaWNrPSJ3aW5kb3cuZm9j
dXMoKSI+RmlyZSBmb2N1cygpIG9uIHRoZSB3aW5kb3c8L2J1dHRvbj4=
</data>

          </attachment>
      

    </bug>

</bugzilla>