diff --git a/source b/source index 4d8cb26a588..fe6b3262e10 100644 --- a/source +++ b/source @@ -76857,51 +76857,59 @@ partial interface Navigator {

Return null.

-

The focus delegate for a focus target, given an optional string - focus trigger (default "other"), is given by the following +

The focus delegate for a focusTarget, given an optional string + focusTrigger (default "other"), is given by the following steps:

    -
  1. Let autofocus delegate be the autofocus delegate for focus - target given focus trigger.

  2. - -
  3. If autofocus delegate is not null, then return autofocus - delegate.

  4. - -
  5. If focus target is a shadow host and its

    If focusTarget is a shadow host and its shadow root's delegates focus is false, then return null.

  6. -
  7. Let parent be focus target.

  8. +
  9. Let whereToLook be focusTarget.

  10. + +
  11. If whereToLook is a shadow host, then set whereToLook + to whereToLook's shadow + root.

  12. + +
  13. Let autofocusDelegate be the autofocus delegate for + whereToLook given focusTrigger.

  14. -
  15. If parent is a shadow host, then set parent to - parent's shadow root.

  16. +
  17. If autofocusDelegate is not null, then return + autofocusDelegate.

  18. -

    For each child of parent's children:

    +

    For each descendant of + whereToLook's descendants, in tree + order:

      +
    1. If descendant is a focusable area, then return + descendant.

    2. +
    3. -

      Let focusable area be child, if child is a - focusable area; otherwise let focusable area be the result of getting the focusable area for child given - focus trigger.

      +

      Let focusableArea be the result of getting the focusable area for descendant given + focusTrigger.

      This step can end up recursing, i.e., the get the focusable area - steps might return the focus delegate of child.

      + steps might return the focus delegate of descendant.

    4. -
    5. If focusable area is not null, then return focusable - area.

    6. +
    7. If focusableArea is not null, then return focusableArea.

    + +

    It's important that we are not looking at the shadow-including descendants here, but instead only + at the descendants. Shadow + hosts are instead handled by the recursive case mentioned above.

  19. Return null.

The above algorithm essentially returns the first suitable focusable - area where the path between its DOM anchor and focus target + area where the path between its DOM anchor and focusTarget delegates focus at any shadow tree boundaries.

The autofocus delegate for a focus target given a focus