-
Notifications
You must be signed in to change notification settings - Fork 759
Description
When the user has focused a ::scroll-button or ::scroll-marker, the returned document.activeElement is the scrolling container as the activeElement API expects an element and this is consistent with having an "inner navigable" on the scrolling container similar to a shadow tree or inner frame per https://html.spec.whatwg.org/multipage/interaction.html#dom-documentorshadowroot-activeelement-dev:
For the purposes of this API, when a child navigable is focused, its container is focused within its parent's active document. For example, if the user moves the focus to a text control in an iframe, the iframe is the element returned by the activeElement API in the iframe's node document.
Similarly, when the focused element is in a different node tree than documentOrShadowRoot, the element returned will be the host that's located in the same node tree as documentOrShadowRoot if documentOrShadowRoot is a shadow-including inclusive ancestor of the focused element, and null if not.
The question is when these pseudos are focused, which elements have :focus or :focus-within styles?
Since the pseudos themselves can be styled by :focus, I think the most natural would be that the scrolling container matches :focus-within but not :focus. This seems the most natural, but is inconsistent with iframes and shadow dom (see demo):
- When an element in a subframe is focused, it seems to not apply focus or focus-within to the frame container
- shadow dom applies
:focusto the host element and:focus-withinto it and its ancestors.