-
Notifications
You must be signed in to change notification settings - Fork 850
Labels
Milestone
Description
Working on some shadow DOM stuff, I noticed that in order to determine whether there are multiple children in the shadow root, we're checking parentElement. For children of the shadow root this is null, which results in an ancestry that just uses the node name. You can reproduce it in the following:
<script src="/axe.js"></script>
<script>
window.onload = () => {
axe.run({ runOnly: 'button-name', ancestry: true }, (err, results) => {
console.log(err || results);
});
};
</script>
<custom-elm>
<template shadowrootmode="open">
<button></button>
<button></button>
</template>
</custom-elm>This will give ['html > body > custom-elm', 'button'] as the ancestry for. BOTH buttons. This doesn't seem to happen with the regular selector axe-core has, which is probably why this has gone unnoticed for so long.
ballendq