To get the focusable area for a focus target that is either an element that is not a focusable area, or is a navigable, given an optional string focus trigger (default "other"), run the first matching set of steps from the following list:

If focus target is an area element with one or more shapes that are focusable areas

Return the shape corresponding to the first img element in tree order that uses the image map to which the area element belongs.

If focus target is an element with one or more scrollable regions that are focusable areas

Return the element's first scrollable region, according to a pre-order, depth-first traversal of the flat tree. [CSSSCOPING]

If focus target is the document element of its Document

Return the Document's viewport.

If focus target is a navigable

Return the navigable's active document.

If focus target is a navigable container with a non-null content navigable

Return the navigable container's content navigable's active document.

If focus target is a shadow host whose shadow root's delegates focus is true
  1. Let focusedElement be the currently focused area of a top-level traversable's DOM anchor.

  2. If focus target is a shadow-including inclusive ancestor of focusedElement, then return focusedElement.

  3. Return the focus delegate for focus target given focus trigger.

For sequential focusability, the handling of shadow hosts and delegates focus is done when constructing the sequential focus navigation order. That is, the focusing steps will never be called on such shadow hosts as part of sequential focus navigation.

Otherwise

Return null.