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

Ancestry selector of shadow root child not guaranteed unique #4563

Closed
WilcoFiers opened this issue Aug 20, 2024 · 0 comments · Fixed by #4606 or #4615
Closed

Ancestry selector of shadow root child not guaranteed unique #4563

WilcoFiers opened this issue Aug 20, 2024 · 0 comments · Fixed by #4606 or #4615
Labels
core Issues in the core code (lib/core) fix Bug fixes

Comments

@WilcoFiers
Copy link
Contributor

WilcoFiers commented Aug 20, 2024

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.

@WilcoFiers WilcoFiers added fix Bug fixes core Issues in the core code (lib/core) labels Aug 20, 2024
@WilcoFiers WilcoFiers added this to the Axe-core 4.11 milestone Aug 20, 2024
WilcoFiers added a commit that referenced this issue Oct 16, 2024
###
[4.10.1](v4.10.0...v4.10.1)
(2024-10-16)

### Bug Fixes

- **aria-allowed-role:** add form to allowed roles of form element
([#4588](#4588))
([d462d67](d462d67)),
closes
[/github.com/dequelabs/axe-core/blob/develop/lib/standards/html-elms.js#L264](https://github.com/dequelabs//github.com/dequelabs/axe-core/blob/develop/lib/standards/html-elms.js/issues/L264)
- **axe.d.ts:** add typings for preload options object
([#4543](#4543))
([72e269f](72e269f))
- **button-name,input-button-name,input-img-alt:** allow label to give
accessible name
([#4607](#4607))
([364eb72](364eb72)),
closes [#4472](#4472)
[#3696](#3696)
[#3696](#3696)
- **get-ancestry:** add nth-child selector for multiple siblings of
shadow root ([#4606](#4606))
([bdd94a2](bdd94a2)),
closes [#4563](#4563)
- **rules:** Change "alternate text" to "alternative text"
([#4582](#4582))
([31e0f61](31e0f61))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues in the core code (lib/core) fix Bug fixes
Projects
None yet
1 participant