mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
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:
@@ -95,7 +95,7 @@ impl Node {
|
||||
.and_then(Element::shadow_root)
|
||||
.is_some_and(|shadow_root| shadow_root.DelegatesFocus())
|
||||
{
|
||||
if let Some(focused_element) = self.owner_document().get_focused_element() {
|
||||
if let Some(focused_element) = self.owner_document().focused_element() {
|
||||
// > Step 2. If focus target is a shadow-including inclusive ancestor of
|
||||
// > focusedElement, then return focusedElement.
|
||||
if self
|
||||
|
||||
Reference in New Issue
Block a user