From ce00f26c3c55ad89cb488b380310a96c56eb04f2 Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Tue, 1 Oct 2024 10:54:20 -0700
Subject: [PATCH 01/17] Spec change for focus-without-user-activation

Cherry-picked from https://github.com/whatwg/html/pull/4585
---
 source | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/source b/source
index 3299988e433..3e95a2cdfa0 100644
--- a/source
+++ b/source
@@ -4876,6 +4876,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
     data-x="">cross-origin-isolated</code></dfn>", which has a <span
     data-x="concept-default-allowlist">default allowlist</span> of <code
     data-x="">'self'</code>.</li>
+    <li>"<dfn data-x="focus-without-user-activation-feature"><code
+      data-x="">focus-without-user-activation</code></dfn>", which has a <span
+      data-x="concept-default-allowlist">default allowlist</span> of <code data-x="">*</code>.</li>
   </ul>
 
 
@@ -80506,6 +80509,11 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
    <li><p>If <var>current</var> is null, then return.</p></li>
 
+   <li><p>If this algorithm is not <span>triggered by user activation</span> and
+    <var>current</var>'s <span>active document</span> is not <span>allowed to use</span> the "<code
+    data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
+    then return.</p></li>
+
    <li><p>Run the <span>focusing steps</span> with <var>current</var>.</p></li>
 
    <li><p>If <var>current</var> is a <span>top-level traversable</span>, user agents are encouraged
@@ -80525,6 +80533,11 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
   method on elements, when invoked, must run the following steps:</p>
 
   <ol>
+    <li><p>If this algorithm is not <span>triggered by user activation</span> and the element's
+      <span>node document</span> is not <span>allowed to use</span> the "<code
+      data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
+      then return.</p></li>
+
    <li><p>If the element is marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
    <li><p>Mark the element as <dfn>locked for focus</dfn>.</p></li>
@@ -80631,6 +80644,11 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
    <li><p>If <var>target</var>'s <span>active sandboxing flag set</span> has the
    <span>sandboxed automatic features browsing context flag</span>, then return.</p></li>
 
+   <li><p>If this algorithm is not <span>triggered by user activation</span> and the
+    <var>target</var> is not <span>allowed to use</span> the "<code
+    data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
+    then return.</p></li>
+
    <li><p><span data-x="list iterate">For each</span> <var>ancestorNavigable</var> of
    <var>target</var>'s <span>ancestor navigables</span>: if <var>ancestorNavigable</var>'s <span
    data-x="nav-document">active document</span>'s <span
@@ -144368,6 +144386,7 @@ INSERT INTERFACES HERE
   Edward Welbourne,
   Edward Z. Yang,
   Ehsan Akhgari,
+  Ehsan Karamad,
   Eira Monstad,
   Eitan Adler,
   Eli Friedman,

From 8fa69a422375611898542cb727eeba8d3ea993c3 Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Wed, 2 Oct 2024 14:08:03 -0700
Subject: [PATCH 02/17] change default allowlist of
 `user-without-user-activation` to `self`.

---
 source | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/source b/source
index 3e95a2cdfa0..4fa218bd37e 100644
--- a/source
+++ b/source
@@ -4877,8 +4877,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
     data-x="concept-default-allowlist">default allowlist</span> of <code
     data-x="">'self'</code>.</li>
     <li>"<dfn data-x="focus-without-user-activation-feature"><code
-      data-x="">focus-without-user-activation</code></dfn>", which has a <span
-      data-x="concept-default-allowlist">default allowlist</span> of <code data-x="">*</code>.</li>
+    data-x="">focus-without-user-activation</code></dfn>", which has a <span
+    data-x="concept-default-allowlist">default allowlist</span> of <code
+    data-x="">`self`</code>.</li>
   </ul>
 
 

From 4ba98645eb84f1f4c1cea31d659703e6987efb8b Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Wed, 2 Oct 2024 14:31:21 -0700
Subject: [PATCH 03/17] Allow focus delegation in iframe when
 `focus-without-user-activation` policy is disabled.

---
 source | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/source b/source
index 4fa218bd37e..fe9e48ffe02 100644
--- a/source
+++ b/source
@@ -80510,7 +80510,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
    <li><p>If <var>current</var> is null, then return.</p></li>
 
-   <li><p>If this algorithm is not <span>triggered by user activation</span> and
+   <li><p>If this algorithm is not <span>triggered by user activation</span> and is not <span>
+    triggered by script execution</span> from <var>current</var>'s <span>ancestor navigables</span>, and
     <var>current</var>'s <span>active document</span> is not <span>allowed to use</span> the "<code
     data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
     then return.</p></li>
@@ -80534,7 +80535,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
   method on elements, when invoked, must run the following steps:</p>
 
   <ol>
-    <li><p>If this algorithm is not <span>triggered by user activation</span> and the element's
+    <li><p>If this algorithm is not <span>triggered by user activation</span> and is not <span>
+      triggered by script execution</span> from element's <span>ancestor navigables</span>, and the element's
       <span>node document</span> is not <span>allowed to use</span> the "<code
       data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
       then return.</p></li>

From 88200572488926e946fd115fc6f1e59258909732 Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Thu, 3 Oct 2024 08:52:39 -0700
Subject: [PATCH 04/17] Fix logical error in `focus-without-user-activation`
 spec.

---
 source | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source b/source
index fe9e48ffe02..7b340fd0b21 100644
--- a/source
+++ b/source
@@ -80510,7 +80510,7 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
    <li><p>If <var>current</var> is null, then return.</p></li>
 
-   <li><p>If this algorithm is not <span>triggered by user activation</span> and is not <span>
+   <li><p>If this algorithm is not <span>triggered by user activation</span> or is not <span>
     triggered by script execution</span> from <var>current</var>'s <span>ancestor navigables</span>, and
     <var>current</var>'s <span>active document</span> is not <span>allowed to use</span> the "<code
     data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
@@ -80535,7 +80535,7 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
   method on elements, when invoked, must run the following steps:</p>
 
   <ol>
-    <li><p>If this algorithm is not <span>triggered by user activation</span> and is not <span>
+    <li><p>If this algorithm is not <span>triggered by user activation</span> or is not <span>
       triggered by script execution</span> from element's <span>ancestor navigables</span>, and the element's
       <span>node document</span> is not <span>allowed to use</span> the "<code
       data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,

From 768a15b69c29943446579a1fd287e8ecf7fd5fac Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Thu, 3 Oct 2024 09:52:50 -0700
Subject: [PATCH 05/17] Add Siye Liu to the `Thanks to` list.

---
 source | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source b/source
index 04db9e46c03..02bf3dd90a8 100644
--- a/source
+++ b/source
@@ -145054,6 +145054,7 @@ INSERT INTERFACES HERE
   Yu Han, <!-- yuzhe-han on GitHub -->
   Simon Spiegel,
   Simon Wülker, <!-- Wuelle on GitHub -->
+  Siye Liu,
   skeww, <!-- on reddit -->
   Smylers,
   Srirama Chandra Sekhar Mogali,

From 35661cf8bcde7660aff0b24077d3968e0bf85305 Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Mon, 7 Oct 2024 11:20:58 -0700
Subject: [PATCH 06/17] Attempt to fix build break.

---
 source | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/source b/source
index 02bf3dd90a8..f2c79d44e18 100644
--- a/source
+++ b/source
@@ -80536,11 +80536,11 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
    <li><p>If <var>current</var> is null, then return.</p></li>
 
-   <li><p>If this algorithm is not <span>triggered by user activation</span> or is not <span>
-    triggered by script execution</span> from <var>current</var>'s <span>ancestor navigables</span>, and
-    <var>current</var>'s <span>active document</span> is not <span>allowed to use</span> the "<code
-    data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
-    then return.</p></li>
+   <li><p>If this algorithm is triggered without <span data-x="transient activation">transient user
+    activation</span> or is not triggered by script execution from <var>current</var>'s <span>
+    ancestor navigables</span>, and <var>current</var>'s <span>active document</span> is not <span>
+    allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
+    focus-without-user-activation</code>" feature, then return.</p></li>
 
    <li><p>Run the <span>focusing steps</span> with <var>current</var>.</p></li>
 
@@ -80561,11 +80561,11 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
   method on elements, when invoked, must run the following steps:</p>
 
   <ol>
-    <li><p>If this algorithm is not <span>triggered by user activation</span> or is not <span>
-      triggered by script execution</span> from element's <span>ancestor navigables</span>, and the element's
-      <span>node document</span> is not <span>allowed to use</span> the "<code
-      data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
-      then return.</p></li>
+   <li><p>If this algorithm is triggered without <span data-x="transient activation">transient user
+    activation</span> or is not triggered by script execution from element's <span>ancestor
+    navigables</span>, and the element's <span>node document</span> is not <span>allowed to use</span>
+    the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
+    feature, then return.</p></li>
 
    <li><p>If the element is marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
@@ -80673,8 +80673,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
    <li><p>If <var>target</var>'s <span>active sandboxing flag set</span> has the
    <span>sandboxed automatic features browsing context flag</span>, then return.</p></li>
 
-   <li><p>If this algorithm is not <span>triggered by user activation</span> and the
-    <var>target</var> is not <span>allowed to use</span> the "<code
+   <li><p>If this algorithm is triggered without <span data-x="transient activation">transient use
+    activation</span> and the <var>target</var> is not <span>allowed to use</span> the "<code
     data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
     then return.</p></li>
 

From 4eab7237d6beb2fb42e6befb8a6d3bcec5856ad2 Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Tue, 8 Oct 2024 19:48:33 -0700
Subject: [PATCH 07/17] Attempt to fix build break. Also fix logic error.

---
 source | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/source b/source
index f2c79d44e18..89897f88922 100644
--- a/source
+++ b/source
@@ -80537,9 +80537,9 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
    <li><p>If <var>current</var> is null, then return.</p></li>
 
    <li><p>If this algorithm is triggered without <span data-x="transient activation">transient user
-    activation</span> or is not triggered by script execution from <var>current</var>'s <span>
-    ancestor navigables</span>, and <var>current</var>'s <span>active document</span> is not <span>
-    allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
+    activation</span> and is not triggered by script execution from <var>current</var>'s
+    <span>ancestor navigables</span>, and <var>current</var>'s <span>active document</span> is not
+    <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
     focus-without-user-activation</code>" feature, then return.</p></li>
 
    <li><p>Run the <span>focusing steps</span> with <var>current</var>.</p></li>
@@ -80562,7 +80562,7 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
   <ol>
    <li><p>If this algorithm is triggered without <span data-x="transient activation">transient user
-    activation</span> or is not triggered by script execution from element's <span>ancestor
+    activation</span> and is not triggered by script execution from element's <span>ancestor
     navigables</span>, and the element's <span>node document</span> is not <span>allowed to use</span>
     the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
     feature, then return.</p></li>

From bfde2ecbe5f8eae46781ffc646eab6110f6945dd Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Wed, 16 Oct 2024 09:25:48 -0700
Subject: [PATCH 08/17] Add focus-without-user-activation logic to `dialog
 focusing steps` and `popover focusing steps`

---
 source | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/source b/source
index 89897f88922..aeef67099a5 100644
--- a/source
+++ b/source
@@ -61524,6 +61524,11 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
   are as follows:</p>
 
   <ol>
+   <li><p>If this algorithm is triggered without <span data-x="transient activation">transient use
+   activation</span> and the <var>target</var> is not <span>allowed to use</span> the "<code
+   data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
+   then return.</p></li>
+
    <li><p>Let <var>control</var> be null.</p></li>
 
    <li><p>If <var>subject</var> has the <code data-x="attr-fe-autofocus">autofocus</code>
@@ -85739,6 +85744,11 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
   element</span> <var>subject</var>:</p>
 
   <ol>
+   <li><p>If this algorithm is triggered without <span data-x="transient activation">transient use
+   activation</span> and the <var>target</var> is not <span>allowed to use</span> the "<code
+   data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
+   then return.</p></li>
+
    <li><p>If <var>subject</var> is a <code>dialog</code> element, then run the <span>dialog focusing
    steps</span> given <var>subject</var> and return.</p></li>
 

From f49ccf5ec446d14651206758a54aa5cbc7c0a69f Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Mon, 11 Nov 2024 14:22:12 -0800
Subject: [PATCH 09/17] Fix identation and quote format.

---
 source | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/source b/source
index aeef67099a5..ff8f870c5c4 100644
--- a/source
+++ b/source
@@ -4879,7 +4879,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
     <li>"<dfn data-x="focus-without-user-activation-feature"><code
     data-x="">focus-without-user-activation</code></dfn>", which has a <span
     data-x="concept-default-allowlist">default allowlist</span> of <code
-    data-x="">`self`</code>.</li>
+    data-x="">'self'</code>.</li>
   </ul>
 
 
@@ -80542,10 +80542,10 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
    <li><p>If <var>current</var> is null, then return.</p></li>
 
    <li><p>If this algorithm is triggered without <span data-x="transient activation">transient user
-    activation</span> and is not triggered by script execution from <var>current</var>'s
-    <span>ancestor navigables</span>, and <var>current</var>'s <span>active document</span> is not
-    <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
-    focus-without-user-activation</code>" feature, then return.</p></li>
+   activation</span> and is not triggered by script execution from <var>current</var>'s
+   <span>ancestor navigables</span>, and <var>current</var>'s <span>active document</span> is not
+   <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
+   focus-without-user-activation</code>" feature, then return.</p></li>
 
    <li><p>Run the <span>focusing steps</span> with <var>current</var>.</p></li>
 
@@ -80567,10 +80567,10 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
   <ol>
    <li><p>If this algorithm is triggered without <span data-x="transient activation">transient user
-    activation</span> and is not triggered by script execution from element's <span>ancestor
-    navigables</span>, and the element's <span>node document</span> is not <span>allowed to use</span>
-    the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-    feature, then return.</p></li>
+   activation</span> and is not triggered by script execution from element's <span>ancestor
+   navigables</span>, and the element's <span>node document</span> is not <span>allowed to use</span>
+   the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
+   feature, then return.</p></li>
 
    <li><p>If the element is marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
@@ -80679,9 +80679,9 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
    <span>sandboxed automatic features browsing context flag</span>, then return.</p></li>
 
    <li><p>If this algorithm is triggered without <span data-x="transient activation">transient use
-    activation</span> and the <var>target</var> is not <span>allowed to use</span> the "<code
-    data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
-    then return.</p></li>
+   activation</span> and the <var>target</var> is not <span>allowed to use</span> the "<code
+   data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
+   then return.</p></li>
 
    <li><p><span data-x="list iterate">For each</span> <var>ancestorNavigable</var> of
    <var>target</var>'s <span>ancestor navigables</span>: if <var>ancestorNavigable</var>'s <span

From 1cdef9a4723fac440fa868d165a38a1bbef5c06e Mon Sep 17 00:00:00 2001
From: Siye Liu <siliu@microsoft.com>
Date: Thu, 19 Dec 2024 09:38:54 -0800
Subject: [PATCH 10/17] Address PR comments.

---
 source | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/source b/source
index ff8f870c5c4..247f4d97619 100644
--- a/source
+++ b/source
@@ -61525,7 +61525,8 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
 
   <ol>
    <li><p>If this algorithm is triggered without <span data-x="transient activation">transient use
-   activation</span> and the <var>target</var> is not <span>allowed to use</span> the "<code
+   activation</span> in <var>current</var>'s <span>relevant global object</span> and <var>current</var>'s
+   <span>active document</span> is not <span>allowed to use</span> the "<code
    data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
    then return.</p></li>
 
@@ -80542,9 +80543,10 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
    <li><p>If <var>current</var> is null, then return.</p></li>
 
    <li><p>If this algorithm is triggered without <span data-x="transient activation">transient user
-   activation</span> and is not triggered by script execution from <var>current</var>'s
-   <span>ancestor navigables</span>, and <var>current</var>'s <span>active document</span> is not
-   <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
+   activation</span> in <var>current</var>'s <span>relevant global object</span> and is not triggered
+   by invoking <code data-x="dom-focus">focus()</code> method on a <span data-x="concept-tree-child">child</span>
+   of <var>current</var>'s <span>ancestor navigables</span>' <span>active document</span>, and <var>current</var>'s
+   <span>active document</span> is not <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
    focus-without-user-activation</code>" feature, then return.</p></li>
 
    <li><p>Run the <span>focusing steps</span> with <var>current</var>.</p></li>
@@ -80567,10 +80569,11 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
   <ol>
    <li><p>If this algorithm is triggered without <span data-x="transient activation">transient user
-   activation</span> and is not triggered by script execution from element's <span>ancestor
-   navigables</span>, and the element's <span>node document</span> is not <span>allowed to use</span>
-   the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-   feature, then return.</p></li>
+   activation</span> in <var>current</var>'s <span>relevant global object</span> and is not triggered
+   by invoking <code data-x="dom-focus">focus()</code> method on a <span data-x="concept-tree-child">child</span>
+   of <var>current</var>'s <span>ancestor navigables</span>' <span>active document</span>, and the element's
+   <span>node document</span> is not <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
+   focus-without-user-activation</code>" feature, then return.</p></li>
 
    <li><p>If the element is marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
@@ -80679,9 +80682,9 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
    <span>sandboxed automatic features browsing context flag</span>, then return.</p></li>
 
    <li><p>If this algorithm is triggered without <span data-x="transient activation">transient use
-   activation</span> and the <var>target</var> is not <span>allowed to use</span> the "<code
-   data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
-   then return.</p></li>
+   activation</span> in <var>current</var>'s <span>relevant global object</span> and <var>target</var>
+   is not <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
+   focus-without-user-activation</code>" feature, then return.</p></li>
 
    <li><p><span data-x="list iterate">For each</span> <var>ancestorNavigable</var> of
    <var>target</var>'s <span>ancestor navigables</span>: if <var>ancestorNavigable</var>'s <span
@@ -85745,7 +85748,8 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
 
   <ol>
    <li><p>If this algorithm is triggered without <span data-x="transient activation">transient use
-   activation</span> and the <var>target</var> is not <span>allowed to use</span> the "<code
+   activation</span> in <var>current</var>'s <span>relevant global object</span> and <var>subject</var>'s
+   <span>active document</span> is not <span>allowed to use</span> the "<code
    data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
    then return.</p></li>
 

From 22b9553149b3a22ab622db80457dcc6402e7049f Mon Sep 17 00:00:00 2001
From: Siye Liu <siliu@microsoft.com>
Date: Thu, 16 Jan 2025 10:56:52 -0800
Subject: [PATCH 11/17] Address PR comments.

---
 source | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/source b/source
index 247f4d97619..cc7107a8a06 100644
--- a/source
+++ b/source
@@ -61524,8 +61524,8 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
   are as follows:</p>
 
   <ol>
-   <li><p>If this algorithm is triggered without <span data-x="transient activation">transient use
-   activation</span> in <var>current</var>'s <span>relevant global object</span> and <var>current</var>'s
+   <li><p>If there is no <span data-x="transient activation">transient user activation</span> in
+   <var>subject</var>'s <span>relevant global object</span> and <var>subject</var>'s
    <span>active document</span> is not <span>allowed to use</span> the "<code
    data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
    then return.</p></li>
@@ -80542,9 +80542,9 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
    <li><p>If <var>current</var> is null, then return.</p></li>
 
-   <li><p>If this algorithm is triggered without <span data-x="transient activation">transient user
-   activation</span> in <var>current</var>'s <span>relevant global object</span> and is not triggered
-   by invoking <code data-x="dom-focus">focus()</code> method on a <span data-x="concept-tree-child">child</span>
+   <li><p>If there is no <span data-x="transient activation">transient user activation</span> in
+   <var>current</var>'s <span>relevant global object</span> and is not triggered by invoking
+   <code data-x="dom-focus">focus()</code> method on a <span data-x="concept-tree-child">child</span>
    of <var>current</var>'s <span>ancestor navigables</span>' <span>active document</span>, and <var>current</var>'s
    <span>active document</span> is not <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
    focus-without-user-activation</code>" feature, then return.</p></li>
@@ -80568,10 +80568,10 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
   method on elements, when invoked, must run the following steps:</p>
 
   <ol>
-   <li><p>If this algorithm is triggered without <span data-x="transient activation">transient user
-   activation</span> in <var>current</var>'s <span>relevant global object</span> and is not triggered
-   by invoking <code data-x="dom-focus">focus()</code> method on a <span data-x="concept-tree-child">child</span>
-   of <var>current</var>'s <span>ancestor navigables</span>' <span>active document</span>, and the element's
+   <li><p>If there is no <span data-x="transient activation">transient user activation</span> in
+   the element's <span>relevant global object</span> and is not triggered by invoking
+   <code data-x="dom-focus">focus()</code> method on a <span data-x="concept-tree-child">child</span>
+   of the element's <span>ancestor navigables</span>' <span>active document</span>, and the element's
    <span>node document</span> is not <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
    focus-without-user-activation</code>" feature, then return.</p></li>
 
@@ -80681,8 +80681,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
    <li><p>If <var>target</var>'s <span>active sandboxing flag set</span> has the
    <span>sandboxed automatic features browsing context flag</span>, then return.</p></li>
 
-   <li><p>If this algorithm is triggered without <span data-x="transient activation">transient use
-   activation</span> in <var>current</var>'s <span>relevant global object</span> and <var>target</var>
+   <li><p>If there is no <span data-x="transient activation">transient use activation</span> in
+   <var>target</var>'s <span>relevant global object</span> and <var>target</var>
    is not <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
    focus-without-user-activation</code>" feature, then return.</p></li>
 
@@ -85747,8 +85747,8 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
   element</span> <var>subject</var>:</p>
 
   <ol>
-   <li><p>If this algorithm is triggered without <span data-x="transient activation">transient use
-   activation</span> in <var>current</var>'s <span>relevant global object</span> and <var>subject</var>'s
+   <li><p>If there is no <span data-x="transient activation">transient user activation</span> in
+   <var>subject</var>'s <span>relevant global object</span> and <var>subject</var>'s
    <span>active document</span> is not <span>allowed to use</span> the "<code
    data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
    then return.</p></li>

From b2214d334e8a9867b2198e3882abb3177d6e2720 Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Tue, 28 Jan 2025 10:49:32 -0800
Subject: [PATCH 12/17] Rephrasing.

---
 source | 56 +++++++++++++++++++++++++++++---------------------------
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/source b/source
index cc7107a8a06..f9b94ba2acc 100644
--- a/source
+++ b/source
@@ -61524,11 +61524,12 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
   are as follows:</p>
 
   <ol>
-   <li><p>If there is no <span data-x="transient activation">transient user activation</span> in
-   <var>subject</var>'s <span>relevant global object</span> and <var>subject</var>'s
-   <span>active document</span> is not <span>allowed to use</span> the "<code
-   data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
-   then return.</p></li>
+   <li><p>If <var>subject</var>'s <span>active document</span> is not <span>allowed to use</span>
+   the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
+   feature, and there is no <span data-x="transient activation">transient user activation</span> in
+   <var>subject</var>'s <span>relevant global object</span>, and <var>subject</var>'s <span>active
+   document</span>'s <span>node navigable</span>'s <span data-x="nav-container">container</span>, if
+   any, is not marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
    <li><p>Let <var>control</var> be null.</p></li>
 
@@ -80542,12 +80543,12 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
    <li><p>If <var>current</var> is null, then return.</p></li>
 
-   <li><p>If there is no <span data-x="transient activation">transient user activation</span> in
-   <var>current</var>'s <span>relevant global object</span> and is not triggered by invoking
-   <code data-x="dom-focus">focus()</code> method on a <span data-x="concept-tree-child">child</span>
-   of <var>current</var>'s <span>ancestor navigables</span>' <span>active document</span>, and <var>current</var>'s
-   <span>active document</span> is not <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
-   focus-without-user-activation</code>" feature, then return.</p></li>
+   <li><p>If <var>current</var>'s <span>active document</span> is not <span>allowed to use</span>
+   the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
+   feature, and there is no <span data-x="transient activation">transient user activation</span> in
+   <var>current</var>'s <span>relevant global object</span>, and <var>current</var>'s <span
+   data-x="nav-container">container</span>, if any, is not marked as <i data-x="locked for focus">locked
+   for focus</i>, then return.</p></li>
 
    <li><p>Run the <span>focusing steps</span> with <var>current</var>.</p></li>
 
@@ -80568,12 +80569,12 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
   method on elements, when invoked, must run the following steps:</p>
 
   <ol>
-   <li><p>If there is no <span data-x="transient activation">transient user activation</span> in
-   the element's <span>relevant global object</span> and is not triggered by invoking
-   <code data-x="dom-focus">focus()</code> method on a <span data-x="concept-tree-child">child</span>
-   of the element's <span>ancestor navigables</span>' <span>active document</span>, and the element's
-   <span>node document</span> is not <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
-   focus-without-user-activation</code>" feature, then return.</p></li>
+   <li><p>If the element's <span>active document</span> is not <span>allowed to use</span> the "
+   <code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
+   feature, and there is no <span data-x="transient activation">transient user activation</span>
+   in the element's <span>relevant global object</span>, and the element's <span>active
+   document</span>'s <span>node navigable</span>'s <span data-x="nav-container">container</span>,
+   if any, is not marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
    <li><p>If the element is marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
@@ -80681,10 +80682,10 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
    <li><p>If <var>target</var>'s <span>active sandboxing flag set</span> has the
    <span>sandboxed automatic features browsing context flag</span>, then return.</p></li>
 
-   <li><p>If there is no <span data-x="transient activation">transient use activation</span> in
-   <var>target</var>'s <span>relevant global object</span> and <var>target</var>
-   is not <span>allowed to use</span> the "<code data-x="focus-without-user-activation-feature">
-   focus-without-user-activation</code>" feature, then return.</p></li>
+   <li><p>If <var>target</var> is not <span>allowed to use</span>the "
+   <code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
+   feature, and there is no <span data-x="transient activation">transient user activation</span>
+   in <var>target</var>'s <span>relevant global object</span>, then return.</p></li>
 
    <li><p><span data-x="list iterate">For each</span> <var>ancestorNavigable</var> of
    <var>target</var>'s <span>ancestor navigables</span>: if <var>ancestorNavigable</var>'s <span
@@ -85747,12 +85748,13 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
   element</span> <var>subject</var>:</p>
 
   <ol>
-   <li><p>If there is no <span data-x="transient activation">transient user activation</span> in
-   <var>subject</var>'s <span>relevant global object</span> and <var>subject</var>'s
-   <span>active document</span> is not <span>allowed to use</span> the "<code
-   data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
-   then return.</p></li>
-
+   <li><p>If <var>subject</var>'s <span>active document</span> is not <span>allowed to use</span>
+   the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
+   feature, and there is no <span data-x="transient activation">transient user activation</span> in
+   <var>subject</var>'s <span>relevant global object</span>, and <var>subject</var>'s <span>active
+   document</span>'s <span>node navigable</span>'s <span data-x="nav-container">container</span>, if
+   any, is not marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
+   
    <li><p>If <var>subject</var> is a <code>dialog</code> element, then run the <span>dialog focusing
    steps</span> given <var>subject</var> and return.</p></li>
 

From ee7682fc160fc3c785d51711a27bb3542004c606 Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Wed, 29 Jan 2025 09:14:40 -0800
Subject: [PATCH 13/17] rephrasing.

---
 source | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/source b/source
index f9b94ba2acc..f46f1e88042 100644
--- a/source
+++ b/source
@@ -61526,10 +61526,10 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
   <ol>
    <li><p>If <var>subject</var>'s <span>active document</span> is not <span>allowed to use</span>
    the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-   feature, and there is no <span data-x="transient activation">transient user activation</span> in
-   <var>subject</var>'s <span>relevant global object</span>, and <var>subject</var>'s <span>active
-   document</span>'s <span>node navigable</span>'s <span data-x="nav-container">container</span>, if
-   any, is not marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
+   feature, and <var>subject</var>'s <span>relevant global object</span> has no <span data-x="transient
+   activation">transient user activation</span>, and <var>subject</var>'s <span>active document</span>'s
+   <span>node navigable</span>'s <span data-x="nav-container">container</span>, if any, is not marked as
+   <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
    <li><p>Let <var>control</var> be null.</p></li>
 
@@ -80545,10 +80545,10 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
    <li><p>If <var>current</var>'s <span>active document</span> is not <span>allowed to use</span>
    the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-   feature, and there is no <span data-x="transient activation">transient user activation</span> in
-   <var>current</var>'s <span>relevant global object</span>, and <var>current</var>'s <span
-   data-x="nav-container">container</span>, if any, is not marked as <i data-x="locked for focus">locked
-   for focus</i>, then return.</p></li>
+   feature, and <var>current</var>'s <span>relevant global object</span> has no <span data-x="transient
+   activation">transient user activation</span>, and <var>current</var>'s
+   <span data-x="nav-container">container</span>, if any, is not marked as <i data-x="locked for
+   focus">locked for focus</i>, then return.</p></li>
 
    <li><p>Run the <span>focusing steps</span> with <var>current</var>.</p></li>
 
@@ -80571,10 +80571,10 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
   <ol>
    <li><p>If the element's <span>active document</span> is not <span>allowed to use</span> the "
    <code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-   feature, and there is no <span data-x="transient activation">transient user activation</span>
-   in the element's <span>relevant global object</span>, and the element's <span>active
-   document</span>'s <span>node navigable</span>'s <span data-x="nav-container">container</span>,
-   if any, is not marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
+   feature, and the element's <span>relevant global object</span> has no <span data-x="transient
+   activation">transient user activation</span>, and the element's <span>active document</span>'s
+   <span>node navigable</span>'s <span data-x="nav-container">container</span>, if any, is not
+   marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
    <li><p>If the element is marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
@@ -80684,8 +80684,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
    <li><p>If <var>target</var> is not <span>allowed to use</span>the "
    <code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-   feature, and there is no <span data-x="transient activation">transient user activation</span>
-   in <var>target</var>'s <span>relevant global object</span>, then return.</p></li>
+   feature, and <var>target</var>'s <span>relevant global object</span> has no <span data-x="transient
+   activation">transient user activation</span>, then return.</p></li>
 
    <li><p><span data-x="list iterate">For each</span> <var>ancestorNavigable</var> of
    <var>target</var>'s <span>ancestor navigables</span>: if <var>ancestorNavigable</var>'s <span
@@ -85750,10 +85750,10 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
   <ol>
    <li><p>If <var>subject</var>'s <span>active document</span> is not <span>allowed to use</span>
    the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-   feature, and there is no <span data-x="transient activation">transient user activation</span> in
-   <var>subject</var>'s <span>relevant global object</span>, and <var>subject</var>'s <span>active
-   document</span>'s <span>node navigable</span>'s <span data-x="nav-container">container</span>, if
-   any, is not marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
+   feature, and <var>subject</var>'s <span>relevant global object</span> has no <span data-x="transient
+   activation">transient user activation</span>, and <var>subject</var>'s <span>active document</span>'s
+   <span>node navigable</span>'s <span data-x="nav-container">container</span>, if any, is not marked as
+   <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
    
    <li><p>If <var>subject</var> is a <code>dialog</code> element, then run the <span>dialog focusing
    steps</span> given <var>subject</var> and return.</p></li>

From 0c2e058b5add1855189d809322255327a7e56ec2 Mon Sep 17 00:00:00 2001
From: Siye Liu <siliu@microsoft.com>
Date: Wed, 26 Feb 2025 16:50:47 -0800
Subject: [PATCH 14/17] put logic inside a common algorithm.

---
 source | 63 ++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 35 insertions(+), 28 deletions(-)

diff --git a/source b/source
index f46f1e88042..f077951d493 100644
--- a/source
+++ b/source
@@ -61524,12 +61524,8 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
   are as follows:</p>
 
   <ol>
-   <li><p>If <var>subject</var>'s <span>active document</span> is not <span>allowed to use</span>
-   the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-   feature, and <var>subject</var>'s <span>relevant global object</span> has no <span data-x="transient
-   activation">transient user activation</span>, and <var>subject</var>'s <span>active document</span>'s
-   <span>node navigable</span>'s <span data-x="nav-container">container</span>, if any, is not marked as
-   <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
+   <li>If the result of running the <span>allow focus steps</span> with <var>subject</var>'s
+   <span>active document</span> as the argument is false, then return.</p></li>
 
    <li><p>Let <var>control</var> be null.</p></li>
 
@@ -80543,12 +80539,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
    <li><p>If <var>current</var> is null, then return.</p></li>
 
-   <li><p>If <var>current</var>'s <span>active document</span> is not <span>allowed to use</span>
-   the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-   feature, and <var>current</var>'s <span>relevant global object</span> has no <span data-x="transient
-   activation">transient user activation</span>, and <var>current</var>'s
-   <span data-x="nav-container">container</span>, if any, is not marked as <i data-x="locked for
-   focus">locked for focus</i>, then return.</p></li>
+   <li>If the result of running the <span>allow focus steps</span> with <var>current</var>'s
+   <span>active document</span> as the argument is false, then return.</p></li>
 
    <li><p>Run the <span>focusing steps</span> with <var>current</var>.</p></li>
 
@@ -80569,12 +80561,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
   method on elements, when invoked, must run the following steps:</p>
 
   <ol>
-   <li><p>If the element's <span>active document</span> is not <span>allowed to use</span> the "
-   <code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-   feature, and the element's <span>relevant global object</span> has no <span data-x="transient
-   activation">transient user activation</span>, and the element's <span>active document</span>'s
-   <span>node navigable</span>'s <span data-x="nav-container">container</span>, if any, is not
-   marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
+   <li>If the result of running the <span>allow focus steps</span> with the element's
+   <span>active document</span> as the argument is false, then return.</p></li>
 
    <li><p>If the element is marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
@@ -80605,6 +80593,31 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
   keyboard users. Ignoring calls to this method would thus allow keyboard users to interact with the
   page.</p>
 
+  <p>The <dfn export>allow focus steps</dfn>, given a <code>Document</code> object <var>target</var>,
+  are as follows:</p>
+  
+  <ol>
+   <li><p>If <var>target</var> is <span>allowed to use</span> the "
+   <code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
+   then return true.</p></li>
+  
+   <li>
+    <p>If any of the following are true:</p>
+
+    <ul>
+     <li><p><var>target</var>'s <span>relevant global object</span> has <span data-x="transient
+     activation">transient user activation</span>; or</p></li>
+
+     <li><p><var>target</var>'s <span>node navigable</span>'s <span data-x="nav-container">container</span>,
+     if any, is marked as <i data-x="locked for focus">locked for focus</i>,</p></li>
+    </ul>
+
+    <p>then return true.</p>
+   </li>
+  
+   <li><p>Return false.</p></li>
+  </ol>
+
   </div>
 
 
@@ -80682,10 +80695,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
    <li><p>If <var>target</var>'s <span>active sandboxing flag set</span> has the
    <span>sandboxed automatic features browsing context flag</span>, then return.</p></li>
 
-   <li><p>If <var>target</var> is not <span>allowed to use</span>the "
-   <code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-   feature, and <var>target</var>'s <span>relevant global object</span> has no <span data-x="transient
-   activation">transient user activation</span>, then return.</p></li>
+   <li>If the result of running the <span>allow focus steps</span> with the <var>target</var> as
+   the argument is false, then return.</p></li>
 
    <li><p><span data-x="list iterate">For each</span> <var>ancestorNavigable</var> of
    <var>target</var>'s <span>ancestor navigables</span>: if <var>ancestorNavigable</var>'s <span
@@ -85748,12 +85759,8 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
   element</span> <var>subject</var>:</p>
 
   <ol>
-   <li><p>If <var>subject</var>'s <span>active document</span> is not <span>allowed to use</span>
-   the "<code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>"
-   feature, and <var>subject</var>'s <span>relevant global object</span> has no <span data-x="transient
-   activation">transient user activation</span>, and <var>subject</var>'s <span>active document</span>'s
-   <span>node navigable</span>'s <span data-x="nav-container">container</span>, if any, is not marked as
-   <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
+   <li>If the result of running the <span>allow focus steps</span> with <var>subject</var>'s
+   <span>active document</span> as the argument is false, then return.</p></li>
    
    <li><p>If <var>subject</var> is a <code>dialog</code> element, then run the <span>dialog focusing
    steps</span> given <var>subject</var> and return.</p></li>

From 846f24f925706f9c79e6ea5821b38d9568410ca9 Mon Sep 17 00:00:00 2001
From: Siye Liu <siliu@microsoft.com>
Date: Thu, 27 Feb 2025 10:21:35 -0800
Subject: [PATCH 15/17] Address PR feedback and fix linting issue.

---
 source | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/source b/source
index f077951d493..bb20d05d926 100644
--- a/source
+++ b/source
@@ -61525,7 +61525,7 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
 
   <ol>
    <li>If the result of running the <span>allow focus steps</span> with <var>subject</var>'s
-   <span>active document</span> as the argument is false, then return.</p></li>
+   <span>node document</span> as the argument is false, then return.</p></li>
 
    <li><p>Let <var>control</var> be null.</p></li>
 
@@ -80539,8 +80539,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
    <li><p>If <var>current</var> is null, then return.</p></li>
 
-   <li>If the result of running the <span>allow focus steps</span> with <var>current</var>'s
-   <span>active document</span> as the argument is false, then return.</p></li>
+   <li>If the result of running the <span>allow focus steps</span> with <var>current</var>'s <span
+   data-x="nav-document">active document</span> as the argument is false, then return.</p></li>
 
    <li><p>Run the <span>focusing steps</span> with <var>current</var>.</p></li>
 
@@ -80561,8 +80561,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
   method on elements, when invoked, must run the following steps:</p>
 
   <ol>
-   <li>If the result of running the <span>allow focus steps</span> with the element's
-   <span>active document</span> as the argument is false, then return.</p></li>
+   <li>If the result of running the <span>allow focus steps</span> with the element's <span>node
+   document</span> as the argument is false, then return.</p></li>
 
    <li><p>If the element is marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
@@ -80595,12 +80595,12 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
   <p>The <dfn export>allow focus steps</dfn>, given a <code>Document</code> object <var>target</var>,
   are as follows:</p>
-  
+
   <ol>
-   <li><p>If <var>target</var> is <span>allowed to use</span> the "
-   <code data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
+   <li><p>If <var>target</var> is <span>allowed to use</span> the "<code
+   data-x="focus-without-user-activation-feature">focus-without-user-activation</code>" feature,
    then return true.</p></li>
-  
+
    <li>
     <p>If any of the following are true:</p>
 
@@ -80614,7 +80614,7 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
     <p>then return true.</p>
    </li>
-  
+
    <li><p>Return false.</p></li>
   </ol>
 
@@ -85761,7 +85761,7 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
   <ol>
    <li>If the result of running the <span>allow focus steps</span> with <var>subject</var>'s
    <span>active document</span> as the argument is false, then return.</p></li>
-   
+
    <li><p>If <var>subject</var> is a <code>dialog</code> element, then run the <span>dialog focusing
    steps</span> given <var>subject</var> and return.</p></li>
 

From 7ea8498ec707c724218cc8deb7f8d25383cad046 Mon Sep 17 00:00:00 2001
From: Siye Liu <siliu@microsoft.com>
Date: Thu, 27 Feb 2025 13:56:37 -0800
Subject: [PATCH 16/17] Address PR comment.

---
 source | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source b/source
index bb20d05d926..fde24bc2760 100644
--- a/source
+++ b/source
@@ -85760,7 +85760,7 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
 
   <ol>
    <li>If the result of running the <span>allow focus steps</span> with <var>subject</var>'s
-   <span>active document</span> as the argument is false, then return.</p></li>
+   <span>node document</span> as the argument is false, then return.</p></li>
 
    <li><p>If <var>subject</var> is a <code>dialog</code> element, then run the <span>dialog focusing
    steps</span> given <var>subject</var> and return.</p></li>

From 2521359c870ea822630c3607df2fbcd26dbea8f0 Mon Sep 17 00:00:00 2001
From: Siye Liu <44512924+siliu1@users.noreply.github.com>
Date: Fri, 28 Feb 2025 08:59:40 -0800
Subject: [PATCH 17/17] Address editorial comments.

---
 source | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/source b/source
index fde24bc2760..a95c1a035d0 100644
--- a/source
+++ b/source
@@ -61524,8 +61524,8 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
   are as follows:</p>
 
   <ol>
-   <li>If the result of running the <span>allow focus steps</span> with <var>subject</var>'s
-   <span>node document</span> as the argument is false, then return.</p></li>
+   <li><p>If the <span>allow focus steps</span> given <var>subject</var>'s <span>node
+   document</span> return false, then return.</p></li>
 
    <li><p>Let <var>control</var> be null.</p></li>
 
@@ -80539,8 +80539,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
 
    <li><p>If <var>current</var> is null, then return.</p></li>
 
-   <li>If the result of running the <span>allow focus steps</span> with <var>current</var>'s <span
-   data-x="nav-document">active document</span> as the argument is false, then return.</p></li>
+   <li><p>If the <span>allow focus steps</span> given <var>current</var>'s <span
+   data-x="nav-document">active document</span> return false, then return.</p></li>
 
    <li><p>Run the <span>focusing steps</span> with <var>current</var>.</p></li>
 
@@ -80561,8 +80561,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
   method on elements, when invoked, must run the following steps:</p>
 
   <ol>
-   <li>If the result of running the <span>allow focus steps</span> with the element's <span>node
-   document</span> as the argument is false, then return.</p></li>
+   <li><p>If the <span>allow focus steps</span> given the element's <span>node document</span>
+   return false, then return.</p></li>
 
    <li><p>If the element is marked as <i data-x="locked for focus">locked for focus</i>, then return.</p></li>
 
@@ -80695,8 +80695,8 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
    <li><p>If <var>target</var>'s <span>active sandboxing flag set</span> has the
    <span>sandboxed automatic features browsing context flag</span>, then return.</p></li>
 
-   <li>If the result of running the <span>allow focus steps</span> with the <var>target</var> as
-   the argument is false, then return.</p></li>
+   <li><p>If the <span>allow focus steps</span> given <var>target</var> return false, then
+   return.</p></li>
 
    <li><p><span data-x="list iterate">For each</span> <var>ancestorNavigable</var> of
    <var>target</var>'s <span>ancestor navigables</span>: if <var>ancestorNavigable</var>'s <span
@@ -85759,8 +85759,8 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
   element</span> <var>subject</var>:</p>
 
   <ol>
-   <li>If the result of running the <span>allow focus steps</span> with <var>subject</var>'s
-   <span>node document</span> as the argument is false, then return.</p></li>
+   <li><p>If the <span>allow focus steps</span> given <var>subject</var>'s <span>node
+   document</span> return false, then return.</p></li>
 
    <li><p>If <var>subject</var> is a <code>dialog</code> element, then run the <span>dialog focusing
    steps</span> given <var>subject</var> and return.</p></li>