From 3bbb870127a6e048f9afadcacca88b78dba6dced Mon Sep 17 00:00:00 2001 From: Rakina Zata Amni Date: Tue, 29 Oct 2019 06:13:10 +0900 Subject: [PATCH] Tweak shadow host focus delegation In particular, don't delegate focus when the shadow host is an ancestor of the currently focused area. Fixes https://github.com/w3c/webcomponents/issues/840. Tests: https://github.com/web-platform-tests/wpt/pull/19867. --- source | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/source b/source index 140a2eb94fa..d6bcb58f4b3 100644 --- a/source +++ b/source @@ -74009,7 +74009,7 @@ END:VCARD
-

Let new focus target be the Document's viewport.

+

Set new focus target to the Document's viewport.

@@ -74040,18 +74040,30 @@ END:VCARD
-

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 new focus - target in the flat tree.

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

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

    +
  3. +

    Otherwise:

    -

    Set new focus target to the first focusable area in tree - order of their DOM anchors in possible focus - delegates, or null if possible focus delegates is empty.

    +
      +
    1. 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 new focus target in the flat tree.
    2. + +
    3. Otherwise, let possible focus delegates be the list of all focusable areas whose DOM anchor is a + descendant of new focus target in the flat tree.
    4. + +
    5. Set new focus target to the first focusable area in tree + order of their DOM anchors in possible focus + delegates, or null if possible focus delegates is empty.
    6. +
    +
  4. +

For sequential focusability, the handling of shadow hosts and delegates focus is