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", which has a default allowlist of 'self'. +
  • "focus-without-user-activation", which has a default allowlist of *.
  • @@ -80506,6 +80509,11 @@ dictionary ToggleEventInit : EventInit {
  • If current is null, then return.

  • +
  • If this algorithm is not triggered by user activation and + current's active document is not allowed to use the "focus-without-user-activation" feature, + then return.

  • +
  • Run the focusing steps with current.

  • If current is a top-level traversable, user agents are encouraged @@ -80525,6 +80533,11 @@ dictionary ToggleEventInit : EventInit { method on elements, when invoked, must run the following steps:

      +
    1. If this algorithm is not triggered by user activation and the element's + node document is not allowed to use the "focus-without-user-activation" feature, + then return.

    2. +
    3. If the element is marked as locked for focus, then return.

    4. Mark the element as locked for focus.

    5. @@ -80631,6 +80644,11 @@ dictionary ToggleEventInit : EventInit {
    6. If target's active sandboxing flag set has the sandboxed automatic features browsing context flag, then return.

    7. +
    8. If this algorithm is not triggered by user activation and the + target is not allowed to use the "focus-without-user-activation" feature, + then return.

    9. +
    10. For each ancestorNavigable of target's ancestor navigables: if ancestorNavigable's active document's 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 of 'self'.

    11. "focus-without-user-activation", which has a default allowlist of *.
    12. + data-x="">focus-without-user-activation", which has a default allowlist of `self`. 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 ToggleEventInit : EventInit {
    13. If current is null, then return.

    14. -
    15. If this algorithm is not triggered by user activation and +

    16. If this algorithm is not triggered by user activation and is not + triggered by script execution from current's ancestor navigables, and current's active document is not allowed to use the "focus-without-user-activation" feature, then return.

    17. @@ -80534,7 +80535,8 @@ dictionary ToggleEventInit : EventInit { method on elements, when invoked, must run the following steps:

        -
      1. If this algorithm is not triggered by user activation and the element's +

      2. If this algorithm is not triggered by user activation and is not + triggered by script execution from element's ancestor navigables, and the element's node document is not allowed to use the "focus-without-user-activation" feature, then return.

      3. 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 ToggleEventInit : EventInit {
      4. If current is null, then return.

      5. -
      6. If this algorithm is not triggered by user activation and is not +

      7. If this algorithm is not triggered by user activation or is not triggered by script execution from current's ancestor navigables, and current's active document is not allowed to use the "focus-without-user-activation" feature, @@ -80535,7 +80535,7 @@ dictionary ToggleEventInit : EventInit { method on elements, when invoked, must run the following steps:

          -
        1. If this algorithm is not triggered by user activation and is not +

        2. If this algorithm is not triggered by user activation or is not triggered by script execution from element's ancestor navigables, and the element's node document is not allowed to use the "focus-without-user-activation" 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, Simon Spiegel, Simon Wülker, + Siye Liu, skeww, 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 ToggleEventInit : EventInit {

        3. If current is null, then return.

        4. -
        5. If this algorithm is not triggered by user activation or is not - triggered by script execution from current's ancestor navigables, and - current's active document is not allowed to use the "focus-without-user-activation" feature, - then return.

        6. +
        7. If this algorithm is triggered without transient user + activation or is not triggered by script execution from current's + ancestor navigables, and current's active document is not + allowed to use the " + focus-without-user-activation" feature, then return.

        8. Run the focusing steps with current.

        9. @@ -80561,11 +80561,11 @@ dictionary ToggleEventInit : EventInit { method on elements, when invoked, must run the following steps:

            -
          1. If this algorithm is not triggered by user activation or is not - triggered by script execution from element's ancestor navigables, and the element's - node document is not allowed to use the "focus-without-user-activation" feature, - then return.

          2. +
          3. If this algorithm is triggered without transient user + activation or is not triggered by script execution from element's ancestor + navigables, and the element's node document is not allowed to use + the "focus-without-user-activation" + feature, then return.

          4. If the element is marked as locked for focus, then return.

          5. @@ -80673,8 +80673,8 @@ dictionary ToggleEventInit : EventInit {
          6. If target's active sandboxing flag set has the sandboxed automatic features browsing context flag, then return.

          7. -
          8. If this algorithm is not triggered by user activation and the - target is not allowed to use the "

            If this algorithm is triggered without transient use + activation and the target is not allowed to use the "focus-without-user-activation" feature, then return.

          9. 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 ToggleEventInit : EventInit {
          10. If current is null, then return.

          11. If this algorithm is triggered without transient user - activation or is not triggered by script execution from current's - ancestor navigables, and current's active document is not - allowed to use the " + activation and is not triggered by script execution from current's + ancestor navigables, and current's active document is not + allowed to use the " focus-without-user-activation" feature, then return.

          12. Run the focusing steps with current.

          13. @@ -80562,7 +80562,7 @@ dictionary ToggleEventInit : EventInit {
            1. If this algorithm is triggered without transient user - activation or is not triggered by script execution from element's ancestor + activation and is not triggered by script execution from element's ancestor navigables, and the element's node document is not allowed to use the "focus-without-user-activation" feature, then return.

            2. 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 HTMLDialogElement : HTMLElement { are as follows:

                +
              1. If this algorithm is triggered without transient use + activation and the target is not allowed to use the "focus-without-user-activation" feature, + then return.

              2. +
              3. Let control be null.

              4. If subject has the autofocus @@ -85739,6 +85744,11 @@ dictionary DragEventInit : MouseEventInit { element subject:

                  +
                1. If this algorithm is triggered without transient use + activation and the target is not allowed to use the "focus-without-user-activation" feature, + then return.

                2. +
                3. If subject is a dialog element, then run the dialog focusing steps given subject and return.

                4. 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
                5. "focus-without-user-activation", which has a default allowlist of `self`.
                6. + data-x="">'self'
                  . @@ -80542,10 +80542,10 @@ dictionary ToggleEventInit : EventInit {
                7. If current is null, then return.

                8. If this algorithm is triggered without transient user - activation and is not triggered by script execution from current's - ancestor navigables, and current's active document is not - allowed to use the " - focus-without-user-activation" feature, then return.

                9. + activation and is not triggered by script execution from current's + ancestor navigables, and current's active document is not + allowed to use the " + focus-without-user-activation" feature, then return.

                10. Run the focusing steps with current.

                11. @@ -80567,10 +80567,10 @@ dictionary ToggleEventInit : EventInit {
                  1. If this algorithm is triggered without transient user - activation and is not triggered by script execution from element's ancestor - navigables, and the element's node document is not allowed to use - the "focus-without-user-activation" - feature, then return.

                  2. + activation and is not triggered by script execution from element's ancestor + navigables, and the element's node document is not allowed to use + the "focus-without-user-activation" + feature, then return.

                  3. If the element is marked as locked for focus, then return.

                  4. @@ -80679,9 +80679,9 @@ dictionary ToggleEventInit : EventInit { sandboxed automatic features browsing context flag, then return.

                  5. If this algorithm is triggered without transient use - activation and the target is not allowed to use the "focus-without-user-activation" feature, - then return.

                  6. + activation and the target is not allowed to use the "focus-without-user-activation" feature, + then return.

                  7. For each ancestorNavigable of target's ancestor navigables: if ancestorNavigable's 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 HTMLDialogElement : HTMLElement {

                    1. If this algorithm is triggered without transient use - activation and the target is not allowed to use the " in current's relevant global object and current's + active document is not allowed to use the "focus-without-user-activation" feature, then return.

                    2. @@ -80542,9 +80543,10 @@ dictionary ToggleEventInit : EventInit {
                    3. If current is null, then return.

                    4. If this algorithm is triggered without transient user - activation and is not triggered by script execution from current's - ancestor navigables, and current's active document is not - allowed to use the " + activation in current's relevant global object and is not triggered + by invoking focus() method on a child + of current's ancestor navigables' active document, and current's + active document is not allowed to use the " focus-without-user-activation" feature, then return.

                    5. Run the focusing steps with current.

                    6. @@ -80567,10 +80569,11 @@ dictionary ToggleEventInit : EventInit {
                      1. If this algorithm is triggered without transient user - activation and is not triggered by script execution from element's ancestor - navigables, and the element's node document is not allowed to use - the "focus-without-user-activation" - feature, then return.

                      2. + activation in current's relevant global object and is not triggered + by invoking focus() method on a child + of current's ancestor navigables' active document, and the element's + node document is not allowed to use the " + focus-without-user-activation" feature, then return.

                      3. If the element is marked as locked for focus, then return.

                      4. @@ -80679,9 +80682,9 @@ dictionary ToggleEventInit : EventInit { sandboxed automatic features browsing context flag, then return.

                      5. If this algorithm is triggered without transient use - activation and the target is not allowed to use the "focus-without-user-activation" feature, - then return.

                      6. + activation in current's relevant global object and target + is not allowed to use the " + focus-without-user-activation" feature, then return.

                      7. For each ancestorNavigable of target's ancestor navigables: if ancestorNavigable's DragEventInit : MouseEventInit {

                        1. If this algorithm is triggered without transient use - activation and the target is not allowed to use the " in current's relevant global object and subject's + active document is not allowed to use the "focus-without-user-activation" feature, then return.

                        2. From 22b9553149b3a22ab622db80457dcc6402e7049f Mon Sep 17 00:00:00 2001 From: Siye Liu 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 HTMLDialogElement : HTMLElement { are as follows:

                            -
                          1. If this algorithm is triggered without transient use - activation in current's relevant global object and current's +

                          2. If there is no transient user activation in + subject's relevant global object and subject's active document is not allowed to use the "focus-without-user-activation" feature, then return.

                          3. @@ -80542,9 +80542,9 @@ dictionary ToggleEventInit : EventInit {
                          4. If current is null, then return.

                          5. -
                          6. If this algorithm is triggered without transient user - activation in current's relevant global object and is not triggered - by invoking focus() method on a child +

                          7. If there is no transient user activation in + current's relevant global object and is not triggered by invoking + focus() method on a child of current's ancestor navigables' active document, and current's active document is not allowed to use the " focus-without-user-activation" feature, then return.

                          8. @@ -80568,10 +80568,10 @@ dictionary ToggleEventInit : EventInit { method on elements, when invoked, must run the following steps:

                              -
                            1. If this algorithm is triggered without transient user - activation in current's relevant global object and is not triggered - by invoking focus() method on a child - of current's ancestor navigables' active document, and the element's +

                            2. If there is no transient user activation in + the element's relevant global object and is not triggered by invoking + focus() method on a child + of the element's ancestor navigables' active document, and the element's node document is not allowed to use the " focus-without-user-activation" feature, then return.

                            3. @@ -80681,8 +80681,8 @@ dictionary ToggleEventInit : EventInit {
                            4. If target's active sandboxing flag set has the sandboxed automatic features browsing context flag, then return.

                            5. -
                            6. If this algorithm is triggered without transient use - activation in current's relevant global object and target +

                            7. If there is no transient use activation in + target's relevant global object and target is not allowed to use the " focus-without-user-activation" feature, then return.

                            8. @@ -85747,8 +85747,8 @@ dictionary DragEventInit : MouseEventInit { element subject:

                                -
                              1. If this algorithm is triggered without transient use - activation in current's relevant global object and subject's +

                              2. If there is no transient user activation in + subject's relevant global object and subject's active document is not allowed to use the "focus-without-user-activation" feature, then return.

                              3. 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 HTMLDialogElement : HTMLElement { are as follows:

                                  -
                                1. If there is no transient user activation in - subject's relevant global object and subject's - active document is not allowed to use the "focus-without-user-activation" feature, - then return.

                                2. +
                                3. If subject's active document is not allowed to use + the "focus-without-user-activation" + feature, and there is no transient user activation in + subject's relevant global object, and subject's active + document's node navigable's container, if + any, is not marked as locked for focus, then return.

                                4. Let control be null.

                                5. @@ -80542,12 +80543,12 @@ dictionary ToggleEventInit : EventInit {
                                6. If current is null, then return.

                                7. -
                                8. If there is no transient user activation in - current's relevant global object and is not triggered by invoking - focus() method on a child - of current's ancestor navigables' active document, and current's - active document is not allowed to use the " - focus-without-user-activation" feature, then return.

                                9. +
                                10. If current's active document is not allowed to use + the "focus-without-user-activation" + feature, and there is no transient user activation in + current's relevant global object, and current's container, if any, is not marked as locked + for focus, then return.

                                11. Run the focusing steps with current.

                                12. @@ -80568,12 +80569,12 @@ dictionary ToggleEventInit : EventInit { method on elements, when invoked, must run the following steps:

                                    -
                                  1. If there is no transient user activation in - the element's relevant global object and is not triggered by invoking - focus() method on a child - of the element's ancestor navigables' active document, and the element's - node document is not allowed to use the " - focus-without-user-activation" feature, then return.

                                  2. +
                                  3. If the element's active document is not allowed to use the " + focus-without-user-activation" + feature, and there is no transient user activation + in the element's relevant global object, and the element's active + document's node navigable's container, + if any, is not marked as locked for focus, then return.

                                  4. If the element is marked as locked for focus, then return.

                                  5. @@ -80681,10 +80682,10 @@ dictionary ToggleEventInit : EventInit {
                                  6. If target's active sandboxing flag set has the sandboxed automatic features browsing context flag, then return.

                                  7. -
                                  8. If there is no transient use activation in - target's relevant global object and target - is not allowed to use the " - focus-without-user-activation" feature, then return.

                                  9. +
                                  10. If target is not allowed to usethe " + focus-without-user-activation" + feature, and there is no transient user activation + in target's relevant global object, then return.

                                  11. For each ancestorNavigable of target's ancestor navigables: if ancestorNavigable's DragEventInit : MouseEventInit { element subject:

                                      -
                                    1. If there is no transient user activation in - subject's relevant global object and subject's - active document is not allowed to use the "focus-without-user-activation" feature, - then return.

                                    2. - +
                                    3. If subject's active document is not allowed to use + the "focus-without-user-activation" + feature, and there is no transient user activation in + subject's relevant global object, and subject's active + document's node navigable's container, if + any, is not marked as locked for focus, then return.

                                    4. +
                                    5. If subject is a dialog element, then run the dialog focusing steps given subject and return.

                                    6. 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 HTMLDialogElement : HTMLElement {
                                      1. If subject's active document is not allowed to use the "focus-without-user-activation" - feature, and there is no transient user activation in - subject's relevant global object, and subject's active - document's node navigable's container, if - any, is not marked as locked for focus, then return.

                                      2. + feature, and subject's relevant global object has no transient user activation, and subject's active document's + node navigable's container, if any, is not marked as + locked for focus, then return.

                                      3. Let control be null.

                                      4. @@ -80545,10 +80545,10 @@ dictionary ToggleEventInit : EventInit {
                                      5. If current's active document is not allowed to use the "focus-without-user-activation" - feature, and there is no transient user activation in - current's relevant global object, and current's container, if any, is not marked as locked - for focus, then return.

                                      6. + feature, and current's relevant global object has no transient user activation, and current's + container, if any, is not marked as locked for focus, then return.

                                      7. Run the focusing steps with current.

                                      8. @@ -80571,10 +80571,10 @@ dictionary ToggleEventInit : EventInit {
                                        1. If the element's active document is not allowed to use the " focus-without-user-activation" - feature, and there is no transient user activation - in the element's relevant global object, and the element's active - document's node navigable's container, - if any, is not marked as locked for focus, then return.

                                        2. + feature, and the element's relevant global object has no transient user activation, and the element's active document's + node navigable's container, if any, is not + marked as locked for focus, then return.

                                        3. If the element is marked as locked for focus, then return.

                                        4. @@ -80684,8 +80684,8 @@ dictionary ToggleEventInit : EventInit {
                                        5. If target is not allowed to usethe " focus-without-user-activation" - feature, and there is no transient user activation - in target's relevant global object, then return.

                                        6. + feature, and target's relevant global object has no transient user activation, then return.

                                        7. For each ancestorNavigable of target's ancestor navigables: if ancestorNavigable's DragEventInit : MouseEventInit {

                                          1. If subject's active document is not allowed to use the "focus-without-user-activation" - feature, and there is no transient user activation in - subject's relevant global object, and subject's active - document's node navigable's container, if - any, is not marked as locked for focus, then return.

                                          2. + feature, and subject's relevant global object has no transient user activation, and subject's active document's + node navigable's container, if any, is not marked as + locked for focus, then return.

                                          3. If subject is a dialog element, then run the dialog focusing steps given subject and return.

                                          4. From 0c2e058b5add1855189d809322255327a7e56ec2 Mon Sep 17 00:00:00 2001 From: Siye Liu 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 HTMLDialogElement : HTMLElement { are as follows:

                                              -
                                            1. If subject's active document is not allowed to use - the "focus-without-user-activation" - feature, and subject's relevant global object has no transient user activation, and subject's active document's - node navigable's container, if any, is not marked as - locked for focus, then return.

                                            2. +
                                            3. If the result of running the allow focus steps with subject's + active document as the argument is false, then return.

                                            4. Let control be null.

                                            5. @@ -80543,12 +80539,8 @@ dictionary ToggleEventInit : EventInit {
                                            6. If current is null, then return.

                                            7. -
                                            8. If current's active document is not allowed to use - the "focus-without-user-activation" - feature, and current's relevant global object has no transient user activation, and current's - container, if any, is not marked as locked for focus, then return.

                                            9. +
                                            10. If the result of running the allow focus steps with current's + active document as the argument is false, then return.

                                            11. Run the focusing steps with current.

                                            12. @@ -80569,12 +80561,8 @@ dictionary ToggleEventInit : EventInit { method on elements, when invoked, must run the following steps:

                                                -
                                              1. If the element's active document is not allowed to use the " - focus-without-user-activation" - feature, and the element's relevant global object has no transient user activation, and the element's active document's - node navigable's container, if any, is not - marked as locked for focus, then return.

                                              2. +
                                              3. If the result of running the allow focus steps with the element's + active document as the argument is false, then return.

                                              4. If the element is marked as locked for focus, then return.

                                              5. @@ -80605,6 +80593,31 @@ dictionary ToggleEventInit : EventInit { keyboard users. Ignoring calls to this method would thus allow keyboard users to interact with the page.

                                                +

                                                The allow focus steps, given a Document object target, + are as follows:

                                                + +
                                                  +
                                                1. If target is allowed to use the " + focus-without-user-activation" feature, + then return true.

                                                2. + +
                                                3. +

                                                  If any of the following are true:

                                                  + +
                                                    +
                                                  • target's relevant global object has transient user activation; or

                                                  • + +
                                                  • target's node navigable's container, + if any, is marked as locked for focus,

                                                  • +
                                                  + +

                                                  then return true.

                                                  +
                                                4. + +
                                                5. Return false.

                                                6. +
                                                + @@ -80682,10 +80695,8 @@ dictionary ToggleEventInit : EventInit {
                                              6. If target's active sandboxing flag set has the sandboxed automatic features browsing context flag, then return.

                                              7. -
                                              8. If target is not allowed to usethe " - focus-without-user-activation" - feature, and target's relevant global object has no transient user activation, then return.

                                              9. +
                                              10. If the result of running the allow focus steps with the target as + the argument is false, then return.

                                              11. For each ancestorNavigable of target's ancestor navigables: if ancestorNavigable's DragEventInit : MouseEventInit { element subject:

                                                  -
                                                1. If subject's active document is not allowed to use - the "focus-without-user-activation" - feature, and subject's relevant global object has no transient user activation, and subject's active document's - node navigable's container, if any, is not marked as - locked for focus, then return.

                                                2. +
                                                3. If the result of running the allow focus steps with subject's + active document as the argument is false, then return.

                                                4. If subject is a dialog element, then run the dialog focusing steps given subject and return.

                                                5. From 846f24f925706f9c79e6ea5821b38d9568410ca9 Mon Sep 17 00:00:00 2001 From: Siye Liu 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 HTMLDialogElement : HTMLElement {
                                                  1. If the result of running the allow focus steps with subject's - active document as the argument is false, then return.

                                                  2. + node document as the argument is false, then return.

                                                  3. Let control be null.

                                                  4. @@ -80539,8 +80539,8 @@ dictionary ToggleEventInit : EventInit {
                                                  5. If current is null, then return.

                                                  6. -
                                                  7. If the result of running the allow focus steps with current's - active document as the argument is false, then return.

                                                  8. +
                                                  9. If the result of running the allow focus steps with current's active document as the argument is false, then return.

                                                  10. Run the focusing steps with current.

                                                  11. @@ -80561,8 +80561,8 @@ dictionary ToggleEventInit : EventInit { method on elements, when invoked, must run the following steps:

                                                      -
                                                    1. If the result of running the allow focus steps with the element's - active document as the argument is false, then return.

                                                    2. +
                                                    3. If the result of running the allow focus steps with the element's node + document as the argument is false, then return.

                                                    4. If the element is marked as locked for focus, then return.

                                                    5. @@ -80595,12 +80595,12 @@ dictionary ToggleEventInit : EventInit {

                                                      The allow focus steps, given a Document object target, are as follows:

                                                      - +
                                                        -
                                                      1. If target is allowed to use the " - focus-without-user-activation" feature, +

                                                      2. If target is allowed to use the "focus-without-user-activation" feature, then return true.

                                                      3. - +
                                                      4. If any of the following are true:

                                                        @@ -80614,7 +80614,7 @@ dictionary ToggleEventInit : EventInit {

                                                        then return true.

                                                      5. - +
                                                      6. Return false.

                                                      @@ -85761,7 +85761,7 @@ dictionary DragEventInit : MouseEventInit {
                                                      1. If the result of running the allow focus steps with subject's active document as the argument is false, then return.

                                                      2. - +
                                                      3. If subject is a dialog element, then run the dialog focusing steps given subject and return.

                                                      4. From 7ea8498ec707c724218cc8deb7f8d25383cad046 Mon Sep 17 00:00:00 2001 From: Siye Liu 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 DragEventInit : MouseEventInit {
                                                        1. If the result of running the allow focus steps with subject's - active document as the argument is false, then return.

                                                        2. + node document as the argument is false, then return.

                                                        3. If subject is a dialog element, then run the dialog focusing steps given subject and return.

                                                        4. 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 HTMLDialogElement : HTMLElement { are as follows:

                                                            -
                                                          1. If the result of running the allow focus steps with subject's - node document as the argument is false, then return.

                                                          2. +
                                                          3. If the allow focus steps given subject's node + document return false, then return.

                                                          4. Let control be null.

                                                          5. @@ -80539,8 +80539,8 @@ dictionary ToggleEventInit : EventInit {
                                                          6. If current is null, then return.

                                                          7. -
                                                          8. If the result of running the allow focus steps with current's active document as the argument is false, then return.

                                                          9. +
                                                          10. If the allow focus steps given current's active document return false, then return.

                                                          11. Run the focusing steps with current.

                                                          12. @@ -80561,8 +80561,8 @@ dictionary ToggleEventInit : EventInit { method on elements, when invoked, must run the following steps:

                                                              -
                                                            1. If the result of running the allow focus steps with the element's node - document as the argument is false, then return.

                                                            2. +
                                                            3. If the allow focus steps given the element's node document + return false, then return.

                                                            4. If the element is marked as locked for focus, then return.

                                                            5. @@ -80695,8 +80695,8 @@ dictionary ToggleEventInit : EventInit {
                                                            6. If target's active sandboxing flag set has the sandboxed automatic features browsing context flag, then return.

                                                            7. -
                                                            8. If the result of running the allow focus steps with the target as - the argument is false, then return.

                                                            9. +
                                                            10. If the allow focus steps given target return false, then + return.

                                                            11. For each ancestorNavigable of target's ancestor navigables: if ancestorNavigable's DragEventInit : MouseEventInit { element subject:

                                                                -
                                                              1. If the result of running the allow focus steps with subject's - node document as the argument is false, then return.

                                                              2. +
                                                              3. If the allow focus steps given subject's node + document return false, then return.

                                                              4. If subject is a dialog element, then run the dialog focusing steps given subject and return.