Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define DocumentOrShadowRoot.activeElement #4837

Merged
merged 5 commits into from
Aug 23, 2019
Merged

Define DocumentOrShadowRoot.activeElement #4837

merged 5 commits into from
Aug 23, 2019

Conversation

rakina
Copy link
Member

@rakina rakina commented Aug 12, 2019

Another part of #2013 and whatwg/dom#768. Moves Document.activeElement to DocumentOrShadowRoot.activeElement


/dom.html ( diff )
/index.html ( diff )
/infrastructure.html ( diff )
/interaction.html ( diff )

@rakina
Copy link
Member Author

rakina commented Aug 12, 2019

cc people involved in previous PRs @rniwa @annevk @domenic

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed some editorial tweaks, but I'd like your help fixing up the domintro for web developers.

source Show resolved Hide resolved
@domenic domenic self-assigned this Aug 12, 2019
@domenic domenic added needs tests Moving the issue forward requires someone to write tests topic: focus topic: shadow Relates to shadow trees (as defined in DOM) labels Aug 12, 2019
@rniwa
Copy link

rniwa commented Aug 13, 2019

FWIW, we've had this implemented in WebKit for a while:
https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/DocumentOrShadowRoot.idl?annotate=blame#L36

@rakina
Copy link
Member Author

rakina commented Aug 13, 2019

FWIW, we've had this implemented in WebKit for a while:
https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/DocumentOrShadowRoot.idl?annotate=blame#L36

Thanks, updated the first post!

@EdgarChen
Copy link
Member

source Show resolved Hide resolved
@rniwa
Copy link

rniwa commented Aug 14, 2019

I guess activeElement's behavior won't be affected by delegatesFocus?

@rniwa
Copy link

rniwa commented Aug 14, 2019

Hm... now that I'm going through some of the tests @rakina wrote, I see that ShadowRoot.activeElement wouldn't point to a slot even if the element inside the slot had a focus. This is kind of a shitty behavior but it'll probably pose too much compatibility risk to change that now. :(

@rniwa
Copy link

rniwa commented Aug 15, 2019

Oh I guess I should have waited for this PR to be merged before merging the WPT PR. But it looks like the remaining issues is really an editorial one so we should just fix that up & merge the PR.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some algorithm tweaks needed. Also, I am curious about the fullscreen connection, e.g. maybe we could use retargeting but then return null if not in the same tree, like fullscreen does.

source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
@rakina
Copy link
Member Author

rakina commented Aug 23, 2019

Some algorithm tweaks needed. Also, I am curious about the fullscreen connection, e.g. maybe we could use retargeting but then return null if not in the same tree, like fullscreen does.

Oh hey you're right, we can actually just retarget and check if the result's root is the DocumentOrShadowRoot! Thank you :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: focus topic: shadow Relates to shadow trees (as defined in DOM)
Development

Successfully merging this pull request may close these issues.

5 participants