<?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>23405</bug_id>
          
          <creation_ts>2013-10-01 05:46:23 +0000</creation_ts>
          <short_desc>&lt;dialog&gt;: When a modal &lt;dialog&gt; is closed, focus should return to where it was when the dialog was shown</short_desc>
          <delta_ts>2014-03-12 23:09:25 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          <dependson>23475</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Matt Falkenhagen">falken</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bugs</cc>
    
    <cc>faulkner.steve</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94061</commentid>
    <comment_count>0</comment_count>
    <who name="Matt Falkenhagen">falken</who>
    <bug_when>2013-10-01 05:46:23 +0000</bug_when>
    <thetext>Looks like this would be a nice addition for accessibility:
https://code.google.com/p/chromium/issues/detail?id=264959#c4

Otherwise, in Chrome currently, focus resets back up to document.body and you must manually navigate back to where you were before the dialog opened.

window.showModalDialog() gets this behavior for free because it doesn&apos;t disrupt the focus of the original document when it opens a new window.

One detail is what to do if the element that had focus no longer exists or is not focusable. I guess we can reset to document.body in that case.

Related is bug 23365, bug 23366</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94111</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-01 20:30:57 +0000</bug_when>
    <thetext>Seems reasonable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96611</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-11-20 23:02:09 +0000</bug_when>
    <thetext>I think we probably actually want to never unfocus the element with control focus when a new &lt;dialog&gt; is given window focus. We probably just want each &lt;dialog&gt;, and the top-level Document, to have its own concept of the focused control.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97432</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-12-10 23:14:57 +0000</bug_when>
    <thetext>This is going to fall out of bug 23475 for free, I think.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102273</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-03-12 23:09:25 +0000</bug_when>
    <thetext>Yup, this just ended up working automatically.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>