From 8615199b5141ce19163d021cfc5cd05b7ef2bd5a Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 16 Sep 2021 16:51:32 -0400 Subject: [PATCH 1/2] Fixes to delegatesFocus * Make it use the shadow tree instead of the flat tree. Closes #7207. * Make it work with the unfocusing steps symmetrically to the focusing steps. Closes #7070. --- source | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/source b/source index 895692dee23..78c7274dd17 100644 --- a/source +++ b/source @@ -75042,9 +75042,10 @@ END:VCARD
    -
  1. If focus target is a shadow-including inclusive ancestor of the - currently focused area of a top-level browsing context's DOM anchor, - then return null.

  2. +
  3. If focus target's shadow + root is a shadow-including inclusive ancestor of the currently + focused area of a top-level browsing context's DOM anchor, then return + null.

  4. Let autofocus delegate be the autofocus delegate for focus target given focus trigger.

  5. @@ -75053,17 +75054,19 @@ END:VCARD delegate.

  6. If focus trigger is "click", then let possible - focus delegates be the list of all click focusable focusable areas whose DOM anchor is a descendant - of focus target in the flat tree.

  7. + focus delegates be the list of all click focusable focusable areas whose DOM anchor is a shadow-including + descendant of focus target's shadow root.

  8. Otherwise, let possible focus delegates be the list of all focusable areas whose DOM anchor is a descendant - of focus target in the flat tree.

  9. + data-x="focusable area">focusable areas whose DOM anchor is a + shadow-including descendant of focus target's shadow root.

    -
  10. Return the first focusable area in tree order of who their - DOM anchors are in possible focus delegates, or - null if possible focus delegates is empty.

  11. +
  12. Return the first focusable area in shadow-including tree + order of who their DOM anchors are in possible + focus delegates, or null if possible focus delegates is empty.

For sequential focusability, the @@ -75166,6 +75169,14 @@ END:VCARD +

  • If old focus target is a shadow host whose shadow root's delegates focus is true, + and old focus target's shadow root + is a shadow-including inclusive ancestor of the currently focused area of a + top-level browsing context's DOM anchor, then set old focus + target to that currently focused area of a top-level browsing + context.

  • +
  • If old focus target is inert, then return.

  • From f2f171d532c381706f577e6c7c7f51cc026f978d Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Mon, 1 Nov 2021 11:31:42 -0400 Subject: [PATCH 2/2] Explicit sorting step --- source | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source b/source index 78c7274dd17..851ea3a4006 100644 --- a/source +++ b/source @@ -75064,9 +75064,12 @@ END:VCARD shadow-including descendant of focus target's shadow root.

  • -
  • Return the first focusable area in shadow-including tree - order of who their DOM anchors are in possible - focus delegates, or null if possible focus delegates is empty.

  • +
  • If possible focus delegates is empty, then return null.

  • + +
  • Sort possible focus delegates by shadow-including tree + order of their DOM anchors.

  • + +
  • Return possible focus delegates[0].

  • For sequential focusability, the