Skip to content

Commit

Permalink
Move the focus to the previously focused element for dialog.close()
Browse files Browse the repository at this point in the history
  • Loading branch information
sefeng211 authored Apr 27, 2021
1 parent cd3d93f commit 5d50bfa
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -57597,6 +57597,9 @@ interface <dfn>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
<li><p>Add an <code data-x="attr-dialog-open">open</code> attribute to the <code>dialog</code>
element, whose value is the empty string.</p></li>

<li><p>Set the <code>dialog</code> element's <span>previously focused element</span> to the
<span>focused</span> element.</p></li>

<li><p>Run the <span>dialog focusing steps</span> for the <code>dialog</code> element.</p></li>
</ol>

Expand Down Expand Up @@ -57636,6 +57639,9 @@ interface <dfn>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
data-x="top-layer-add">add</span> <var>subject</var> to <var>subject</var>'s <span>node
document</span>'s <span>top layer</span>.</p></li>

<li><p>Set the <var>subject</var>'s <span>previously focused element</span> to the
<span>focused</span> element.</p></li>

<li><p>Run the <span>dialog focusing steps</span> for <var>subject</var>.</p></li>
</ol>

Expand Down Expand Up @@ -57709,6 +57715,20 @@ interface <dfn>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
<li><p>If <var>subject</var> is in its <code>Document</code>'s <span>top layer</span>, then <span
data-x="list remove">remove</span> it.</p></li>

<li>
<p>If <var>subject</var>'s <span>previously focused element</span> is not null, then:<p>

<ol>
<li><p>Let <var>element</var> be <var>subject</var>'s <span>previously focused
element</span>.</p></li>

<li><p>Set <var>subject</var>'s <span>previously focused element</span> to null.</p></li>

<li><p>Run the <span>focusing steps</span> for <var>element</var>; the viewport should not be
scrolled by doing this step.</p></li>
</ol>
</li>

<li><p><span>Queue an element task</span> on the <span>user interaction task source</span> given the
<var>subject</var> element to <span data-x="concept-event-fire">fire an event</span> named
<code data-x="event-close">close</code> at <var>subject</var>.</p></li>
Expand Down Expand Up @@ -57743,6 +57763,11 @@ interface <dfn>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
<p>Each <code>dialog</code> element has an <dfn>is modal</dfn> flag. When a <code>dialog</code>
element is created, this flag must be set to false.</p>

<p>Each <code>dialog</code> element has a <dfn>previously focused element</dfn> which is null or
an element, and it is initially null. When <code data-x="dom-dialog-showModal">showModal()</code>
and <code data-x="dom-dialog-show">show()</code> are called, this element is set to the currently
<span>focused</span> element before running the <span>dialog focusing steps</span>.</p>

<hr>

<p>The <dfn attribute for="HTMLDialogElement"><code data-x="dom-dialog-open">open</code></dfn> IDL
Expand Down

0 comments on commit 5d50bfa

Please sign in to comment.