script: Fully implement DocumentOrShadowRoot#activeElement (#43861)

`DocumentOrShadowRoot#activeElement` should return retargeted results.
What that means is that if the DOM anchor of the `Document`'s focused
focusable area is within a shadow root, `Document#activeElement` should
return the shadow host. This change implements that behavior, properly
returning the `activeElement` from both `Document` and `ShadowRoot`.

Testing: This causes a decent number of WPT tests and subtests to start
passing. One subtest starts to fail, because it uses the `autofocus`
attribute
which we do not yet support.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2026-04-02 13:12:30 +02:00
committed by GitHub
parent 9a43d43c32
commit 33f74feffd
27 changed files with 68 additions and 165 deletions

View File

@@ -7,6 +7,3 @@
[Focus should be moved to the previously focused element even if it has moved to shadow DOM root in between show/close]
expected: FAIL
[Focus should be moved to the shadow DOM host if the previouly focused element is a shadow DOM node]
expected: FAIL