-
Notifications
You must be signed in to change notification settings - Fork 789
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
Add include shadow element #3765
Comments
Currently this isn't possible. We had a ticket for it, but closed it due to lack of use cases. Do you have a use case for doing this? |
hi @straker |
I think the best you could do at the moment is select the top-most custom element that has the shadow DOM. We can leave this ticket open for now now that we have a use case for it and start exploring it again. |
@straker Sure, i can use the top-most custom element for now. But just let you know that that top-most element is a parent that nested with a lot of shadow DOMs developed by different UI teams 😅 |
I think this would be a good thing for us to resolve. For now there is a workaround you could use. You can include DOM nodes, including shadow nodes. If you wanted you could create a little shadowRoot query function. Something like this: function getShadowNode(...queries) {
let node, query;
while (query = queries.shift()) {
node = (node?.shadowRoot ?? node ?? document)
.querySelector(query);
}
return node;
}
const shadowNode = getShadowNode('#shadow-root', '#nested-elm', '#my-team')
axe.run(shadowNode); |
In hindsight... axe-core has a utility function that lets you select individual nodes from shadow DOM trees that will work today: const shadowNode = axe.utils.shadowSelect('#shadow-root', '#nested-elm', '#my-team')
axe.run(shadowNode); |
Product
axe-core
Question
Hi,
I am currently working on a project for my company and would like to know how I can add my shadow element under the include selector list?
The text was updated successfully, but these errors were encountered: