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

How to exclude element in a list? #4061

Closed
MelSumner opened this issue Jun 20, 2023 · 2 comments
Closed

How to exclude element in a list? #4061

MelSumner opened this issue Jun 20, 2023 · 2 comments
Labels

Comments

@MelSumner
Copy link

Product

axe-core

Question

I use <li role="separator"> inside of lists.

I don't mind it if axe wants to fail on that, but how do I target it in an exclude?

I tried using selectors but it fails on the list element itself, not the li element. So I can only exclude on the list itself.

I'd prefer not to exclude the whole list, because it's a component and users could invoke it incorrectly and I do want a11y tests to catch that. I only want to exclude a list item with the role of separator.

Any ideas here?

@MelSumner MelSumner added question ungroomed Ticket needs a maintainer to prioritize and label labels Jun 20, 2023
@WilcoFiers
Copy link
Contributor

Hey Melanie. Yeah, I'm not sure what's up with separator in lists. I opened an issue on it with ARIA a while back (w3c/aria#1889).

Axe-core will ignore items with aria-hidden and role="none"; although if you use role=none you do need to make sure there's nothing inside that li that could get included in the accessibility tree. That should get assistive tech to skip them consistently and ignore them in the listitem count.

@WilcoFiers WilcoFiers removed the ungroomed Ticket needs a maintainer to prioritize and label label Jun 23, 2023
@MelSumner
Copy link
Author

ok I will try adding aria-hidden on the li with the role of separator. Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants