Skip to content

Commit

Permalink
Add notes explaining how <dialog>.showModal() focuses
Browse files Browse the repository at this point in the history
It was unclear how the "focus fixup rule" came into play, since that
rule is done using action at a distance. This inserts notes explicitly
calling out what happens.

See web-platform-tests/wpt#23485 for background.
  • Loading branch information
domenic committed May 11, 2020
1 parent c79c594 commit 5a67303
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -56626,8 +56626,17 @@ interface <dfn>HTMLDialogElement</dfn> : <span>HTMLElement</span> {

<li><p>Set the <code>dialog</code> to the <span>centered alignment</span> mode.</p></li>

<li><p>Let <var>subject</var>'s <span>node document</span> be <span data-x="blocked by a
modal dialog">blocked by the modal dialog</span> <var>subject</var>.</p></li>
<li>
<p>Let <var>subject</var>'s <span>node document</span> be <span data-x="blocked by a
modal dialog">blocked by the modal dialog</span> <var>subject</var>.</p>

<p class="note" id="note-dialog-plus-focus-fixup">This will cause the <span>focused area of the
document</span> to become <span>inert</span> (unless that currently focused area is a
<span>shadow-including descendant</span> of <var>subject</var>). In such cases, the <span>focus
fixup rule</span> will kick in and reset the <span>focused area of the document</span> to the
<span>viewport</span> for now. In a couple steps we will attempt to find a better candidate to
focus.</p>
</li>

<li><p>If <var>subject</var>'s <span>node document</span>'s <span>top layer</span> does not
already <span data-x="list contains">contain</span> <var>subject</var>, then <span
Expand All @@ -56653,7 +56662,13 @@ interface <dfn>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
<p>If there isn't one of those either, then let <var>control</var> be <var>subject</var>.</p>
</li>

<li><p>Run the <span>focusing steps</span> for <var>control</var>.</p></li>
<li>
<p>Run the <span>focusing steps</span> for <var>control</var>.</p>

<p class="note">If <var>control</var> is not <span>focusable</span>, this will do nothing. For
modal dialogs, this means that any <a href="#note-dialog-plus-focus-fixup">earlier
modifications</a> to the <span>focused area of the document</span> will apply.</p>
</li>

<li><p>Let <var>topDocument</var> be the <span>active document</span> of <var>control</var>'s
<span>node document</span>'s <span data-x="concept-document-bc">browsing context</span>'s
Expand Down

0 comments on commit 5a67303

Please sign in to comment.