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

Fix shadow-dom/focus/focus-selector-delegatesFocus.html for slotted elements #19530

Conversation

rniwa
Copy link
Contributor

@rniwa rniwa commented Oct 4, 2019

As specified in https://html.spec.whatwg.org/multipage/semantics-other.html#element-has-the-focus, an element has focus when itself is in the focus chain or its shadow root contains the focused element.

Since the shadow tree does not contain a slotted element, its shadow host should not match :focus pseudo class. Otherwise, the shadow host's tree would end up containing more than one element which match :focus, for example, the shadow host and its direct child which is actually focused.

…lements

As specified in https://html.spec.whatwg.org/multipage/semantics-other.html#element-has-the-focus,
an element has focus when itself is in the focus chain or its shadow root contains the focused element.

Since the shadow tree does not contain a slotted element, its shadow host should not match :focus pseudo class.
Otherwise, the shadow host's tree would end up containing more than one element which match :focus,
for example, the shadow host and its direct child which is actually focused.
@rniwa
Copy link
Contributor Author

rniwa commented Oct 4, 2019

@rakina

Copy link
Contributor

@rakina rakina left a comment

Choose a reason for hiding this comment

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

Good catch, thanks!

@emilio emilio merged commit 080acb0 into web-platform-tests:master Oct 6, 2019
@rniwa rniwa deleted the fix-focus-selector-delegatesFocus-for-slotted branch August 2, 2022 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants