Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the focus to the previously focused element for dialog.close() #6531

Merged
merged 5 commits into from
Apr 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -57498,6 +57498,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
sefeng211 marked this conversation as resolved.
Show resolved Hide resolved
sefeng211 marked this conversation as resolved.
Show resolved Hide resolved
<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 @@ -57537,6 +57540,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 @@ -57610,6 +57616,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>
sefeng211 marked this conversation as resolved.
Show resolved Hide resolved

<li>
sefeng211 marked this conversation as resolved.
Show resolved Hide resolved
<p>If <var>subject</var>'s <span>previously focused element</span> is not null, then:<p>
sefeng211 marked this conversation as resolved.
Show resolved Hide resolved
sefeng211 marked this conversation as resolved.
Show resolved Hide resolved

<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 @@ -57644,6 +57664,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