Skip to content

Commit

Permalink
Remove the concept of "dialog group"
Browse files Browse the repository at this point in the history
This change mechanically removes the concept of "dialog group", its
definition, and its references. In doing so, the three focus fixup rules
collapsed to one (now just named "focus fixup rule"), and the concept of
"primary control group" became unnecessary.

"Dialog group" was used to define the focusing behavior of nested
dialogs (mainly for the non-modal case), but actual implementations
don't follow that behavior.

This is a step toward removing "control groups" completely, per #2171.
  • Loading branch information
Takayoshi Kochi authored and domenic committed Mar 15, 2018
1 parent ac52e65 commit a4bb346
Showing 1 changed file with 9 additions and 130 deletions.
139 changes: 9 additions & 130 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -72509,28 +72509,6 @@ END:VCARD</pre>

<hr>

<p>Each <span>control group owner object</span> can also act as the <dfn data-x="dialog group
manager">manager</dfn> of a <dfn>dialog group</dfn>.</p>

<p>Each <code>dialog</code> element that has an <code data-x="attr-dialog-open">open</code>
attribute specified and that is <span>being rendered</span> (i.e. that is a <span>control group
owner object</span>) and is not <span>expressly inert</span>
belongs to the <span>dialog group</span> whose <span data-x="dialog group manager">manager</span> is
the <code>dialog</code> element's nearest ancestor <span>control group owner object</span>.</p>

<p>If no <code>dialog</code> element has a particular <span>control group owner object</span> as
its nearest ancestor <span>control group owner object</span>, then that <span>control group owner
object</span> has no <span>dialog group</span>.</p>

<p>Each <span>dialog group</span> can have a <code>dialog</code> designated as the <dfn>focused
dialog of the dialog group</dfn>. Which <code>dialog</code> is so designated changes over time,
based on algorithms in this specification.</p>

<p>Elements in <span data-x="dialog group">dialog groups</span> are ordered in <span>tree
order</span>.</p>

<hr>

<p>One <span>focusable area</span> in each non-empty <span>control group</span> is designated the
<dfn>focused area of the control group</dfn>. Which control is so designated changes over time,
based on algorithms in this specification. If a <span>control group</span> is empty, it has no <span
Expand All @@ -72554,11 +72532,7 @@ END:VCARD</pre>

<li>

<p>If <var>candidate</var> has a <span>dialog group</span> with a designated
<span>focused dialog of the dialog group</span>, then let <var>candidate</var> be the
designated <span>focused dialog of the dialog group</span>, and redo this step.</p>

<p>Otherwise, if <var>candidate</var> has a non-empty <span>control group</span>, and the
<p>If <var>candidate</var> has a non-empty <span>control group</span>, and the
designated <span>focused area of the control group</span> is a <span>browsing context
container</span> with a non-null <span>nested browsing context</span>, then let
<var>candidate</var> be the <span>active document</span> of that <span>browsing context
Expand Down Expand Up @@ -72606,11 +72580,7 @@ END:VCARD</pre>

<li>

<p>If <var>current object</var> is a <code>dialog</code> object in a <span>dialog group</span>,
let <var>current object</var> be that <span>dialog group</span>'s <span data-x="dialog group
manager">manager</span>, and return to the step labeled <i>loop</i>.</p>

<p>Otherwise, if <var>current object</var> is a <span>focusable area</span>, let <var>current
<p>If <var>current object</var> is a <span>focusable area</span>, let <var>current
object</var> be that <span>focusable area</span>'s <span>control group</span>'s <span
data-x="control group owner object">owner object</span>, and return to the step labeled
<i>loop</i>.</p>
Expand Down Expand Up @@ -72894,13 +72864,7 @@ END:VCARD</pre>

<li>

<p>If <var>new focus target</var> is a <span>control group owner object</span> that is
not a <span>focusable area</span>, but does have a <span>dialog group</span>, and that <span>dialog group</span>
has a designated <span data-x="focused dialog of the dialog group">focused dialog</span>, then
let <var>new focus target</var> be the <span>focused dialog of the dialog
group</span>, and redo this step.</p>

<p>Otherwise, if <var>new focus target</var> is a <span>control group owner
<p>If <var>new focus target</var> is a <span>control group owner
object</span> that is not a <span>focusable area</span>, and its <span>control group</span> is not empty,
then designate <var>new focus target</var> as the <span>focused area of the control
group</span>, and redo this step.</p>
Expand Down Expand Up @@ -72969,12 +72933,7 @@ END:VCARD</pre>

<li>

<p>If <var>old focus target</var> is a <code>dialog</code> in a <span>dialog group</span>, and
the <span>dialog group manager</span> has a non-empty <span>control group</span>, then let
<var>new focus target</var> be the designated <span data-x="focused area of the control
group">focused area of that focus group</span>.</p>

<p>Otherwise, if <var>old focus target</var> is a <span>focusable area</span>, then let <var>new
<p>If <var>old focus target</var> is a <span>focusable area</span>, then let <var>new
focus target</var> be the first <span>focusable area</span> of its <span>control group</span>
(if the <span>control group owner object</span> is a <code>Document</code>, this will always be
a <span>viewport</span>).</p>
Expand Down Expand Up @@ -73003,13 +72962,7 @@ END:VCARD</pre>
<p>When a <span>focusable area</span> is added to an empty <span>control group</span>, it must be designated
the <span>focused area of the control group</span>.</p>

<p>When a <span>dialog group</span> is formed, if the <span>dialog group manager</span> has an empty
<span>control group</span>, the first non-<span>inert</span> <code>dialog</code> in the <span>dialog
group</span>, if any, or else the first <code>dialog</code> in the <span>dialog group</span> regardless of
<span data-x="inert">inertness</span>, must be designated the <span>focused dialog of the dialog
group</span>.</p>

<p><dfn>Focus fixup rule one</dfn>: When the designated <span data-x="focused area of the control
<p><dfn>Focus fixup rule</dfn>: When the designated <span data-x="focused area of the control
group">focused area of a control group</span> is removed from that <span>control group</span> in
some way (e.g. it stops being a <span>focusable area</span>, it is removed from the DOM, it
becomes <span>expressly inert</span>, etc), and the <span>control group</span> is still not
Expand All @@ -73034,60 +72987,6 @@ END:VCARD</pre>
data-x="dom-document-activeElement">activeElement</code> API as <span>the body
element</span>.</p>

<p><dfn>Focus fixup rule two</dfn>: When a <span>dialog group</span> has no designated <span>focused
dialog of the dialog group</span>, and its <span>dialog group manager</span>'s <span>control
group</span> changes from being non-empty to being empty, the first non-<span>inert</span>
<code>dialog</code> in the <span>dialog group</span>, if any, or else the first <code>dialog</code> in
the <span>dialog group</span> regardless of <span data-x="inert">inertness</span>, must be designated
the <span>focused dialog of the dialog group</span>.</p>

<p><dfn>Focus fixup rule three</dfn>: When the designated <span data-x="focused dialog of the
dialog group">focused dialog of a dialog group</span> is removed from that <span>dialog
group</span> in some way (e.g. it stops <span>being rendered</span>, it loses its <code
data-x="attr-dialog-open">open</code> attribute, it becomes <span>expressly inert</span>, etc),
and there is still a <span>dialog group</span> (because the <code>dialog</code> in question was
not the last <code>dialog</code> in that <span>dialog group</span>): if the <span>dialog
group</span>'s <span data-x="dialog group manager">manager</span>'s <span>control group</span> is
non-empty, let there be no designated <span>focused dialog of the dialog group</span> any more;
otherwise (in the case that the <span>control group</span> is empty), designate the first
non-<span>inert</span> <code>dialog</code> in the <span>dialog group</span> to be the
<span>focused dialog of the dialog group</span>, or, if they are all <span>inert</span>, designate
the first <code>dialog</code> in the <span>dialog group</span> to be the <span>focused dialog of
the dialog group</span> regardless of <span data-x="inert">inertness</span>.</p>

<p>When the <span>currently focused area of a top-level browsing context</span> was a <span>focusable
area</span> but stops being a <span>focusable area</span>, or when it was a <code>dialog</code> in a
<span>dialog group</span> and stops being part of that <span>dialog group</span>, or when it
starts being <span>inert</span>, the user agent must run the following steps:</p>

<ol> <!-- this is basically a special-cased version of the focusing steps -->

<li><p>Let <var>old focus target</var> be whatever the <span data-x="currently focused
area of a top-level browsing context">currently focused area of the top-level browsing
context</span> was immediately before this algorithm became applicable (e.g. before the element
was disabled, or the dialog was closed, or whatever caused this algorithm to run).</p></li>

<li><p>Let <var>old chain</var> be the <span>focus chain</span> of the <span
data-x="currently focused area of a top-level browsing context">currently focused area of the
top-level browsing context</span> at the same time.</p></li>

<li><p>Make sure that the changes implied by the focus fixup rules <span data-x="focus fixup rule
one">one</span>, <span data-x="focus fixup rule two">two</span>, and <span data-x="focus fixup
rule three">three</span> above are applied.</p></li>

<li><p>Let <var>new focus target</var> be the <span>currently focused area of a
top-level browsing context</span>.</p></li>

<li><p>If <var>old focus target</var> and <var>new focus target</var> are the
same, return.</p></li>

<li><p>Let <var>new chain</var> be the <span>focus chain</span> of <var>new
focus target</var>.</p></li>

<li><p>Run the <span>focus update steps</span> with <var>old chain</var>, <var>new chain</var>, and <var>new focus target</var> respectively.</p></li>

</ol>

<hr>

<p>The <dfn>focus update steps</dfn>, given an <var>old chain</var>, a <var>new chain</var>, and a <var>new focus target</var> respectively, are as
Expand Down Expand Up @@ -73162,17 +73061,10 @@ END:VCARD</pre>

<ol>

<li><p>If <var>entry</var> is a <code>dialog</code> element: let <var>entry</var> be the
designated <span data-x="focused dialog of the dialog group">focused dialog of its dialog
group</span>.</p></li>

<li>

<p>If <var>entry</var> is a <span>focusable area</span>: designate <var>entry</var> as the
<span>focused area of the control group</span>. If its <span>control group</span>'s <span
data-x="control group owner object">owner object</span> is also a <span>dialog group
manager</span>, then let there be no designated <span data-x="focused dialog of the dialog
group">focused dialog</span> in that <span>dialog group</span>.</p>
<span>focused area of the control group</span>.</p>

<p class="note">It is possible for <var>entry</var> to be both a <code>dialog</code>
element and a <span>focusable area</span>, in which case it is its own <span>control group
Expand Down Expand Up @@ -73290,11 +73182,7 @@ END:VCARD</pre>

<li>

<p>If <var>candidate</var> has a <span>dialog group</span> with a designated <span>focused
dialog of the dialog group</span>, then let <var>candidate</var> be the designated
<span>focused dialog of the dialog group</span>, and redo this step.</p>

<p>Otherwise, if <var>candidate</var> has a non-empty <span>control group</span>, and the
<p>If <var>candidate</var> has a non-empty <span>control group</span>, and the
designated <span>focused area of the control group</span> is a <span>browsing context
container</span> with a non-null <span>nested browsing context</span>, and the <span>active
document</span> of that <span>browsing context container</span>'s <span>nested browsing
Expand Down Expand Up @@ -73435,8 +73323,8 @@ END:VCARD</pre>
<tbody>
<tr>
<th><var>starting point</var> is a <span>browsing context</span>
<td>Let <var>candidate</var> be the first <span>suitable sequentially focusable area</span> in <var>starting point</var>'s <span>active document</span>'s <span>primary control group</span>, if any; or else null
<td>Let <var>candidate</var> be the last <span>suitable sequentially focusable area</span> in <var>starting point</var>'s <span>active document</span>'s <span>primary control group</span>, if any; or else null
<td>Let <var>candidate</var> be the first <span>suitable sequentially focusable area</span> in <var>starting point</var>'s <span>active document</span>'s <span>control group</span>, if any; or else null
<td>Let <var>candidate</var> be the last <span>suitable sequentially focusable area</span> in <var>starting point</var>'s <span>active document</span>'s <span>control group</span>, if any; or else null
<tr>
<th><var>selection mechanism</var> is <i>DOM</i>
<td>Let <var>candidate</var> be the first <span>suitable sequentially focusable area</span> in the <span>home control group</span> following <var>starting point</var>, if any; or else null
Expand All @@ -73452,11 +73340,6 @@ END:VCARD</pre>
anchor</span> is not <span>inert</span> and that is in its <span>control group</span>'s <span>sequential
focus navigation order</span>.</p>

<p>The <dfn>primary control group</dfn> of a <span>control group owner object</span> <var>X</var> is the <span>control group</span> of <var>X</var> if <var>X</var> has no <span>dialog group</span> or if its <span>dialog group</span> has no
designated <span>focused dialog of the dialog group</span>, otherwise, it is the <span>primary
control group</span> of <var>X</var>'s <span>dialog group</span>'s designated
<span>focused dialog of the dialog group</span>.</p>

<p>The <dfn>home control group</dfn> is the <span>control group</span> to which <var>starting point</var> belongs.</p>

<p>The <dfn>home sequential focus navigation order</dfn> is the <span>sequential focus
Expand Down Expand Up @@ -73601,10 +73484,6 @@ END:VCARD</pre>
<ol>
<li><p>Let <var>candidate</var> be this <code>Document</code> object.</p></li>

<li><p>While <var>candidate</var> has a <span>dialog group</span> with a designated
<span>focused dialog of the dialog group</span>, set <var>candidate</var> to the
designated <span>focused dialog of the dialog group</span>.</p></li>

<li><p>If <var>candidate</var> has a non-empty <span>control group</span>, then set
<var>candidate</var> to the designated <span>focused area of the control group</span>.</p></li>

Expand Down

0 comments on commit a4bb346

Please sign in to comment.