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

Accessibility test fails for SelectSeparator #3315

Open
sidx1024 opened this issue Jan 11, 2024 · 6 comments
Open

Accessibility test fails for SelectSeparator #3315

sidx1024 opened this issue Jan 11, 2024 · 6 comments

Comments

@sidx1024
Copy link

sidx1024 commented Jan 11, 2024

Current behavior

I ran a test on SelectGroup example with axe-core DevTools and it reports that "Certain ARIA roles must contain particular children" for listbox.

It seems the following DOM structure violates a11y guidelines?

<div role="listbox">
  <hr role="separator" />
</div>

Steps to reproduce the bug

  1. Open SelectGroup example: https://ariakit.org/examples/select-group
  2. Keep the select dropdown open (This is required)
  3. Run a scan with axe-core DevTools (Download from Chrome Web Store if not installed: https://chromewebstore.google.com/detail/axe-devtools-web-accessib/lhdoppojpmngadmnindnejefpokejbdd)

Expected behavior

Usage of SelectSeparator should not violate accessibility

Workaround

#3315 (comment)

Possible solutions

No response

@diegohaz
Copy link
Member

diegohaz commented Jan 11, 2024

Thanks for reporting. Here's a related issue: dequelabs/axe-core#3938

For now, you can either remove the component from your code and use borders around groups instead, or you can pass role={undefined} aria-hidden to it.

We should probably deprecate the SelectSeparator component (and probably ComboboxSeparator as well).

@IanVS
Copy link

IanVS commented Jan 23, 2024

It seems that the SelectSeparator is deprecated already, but I can't find mention of it in the changelog.

Also, the SelectGroup example still uses it. https://ariakit.org/examples/select-group

@diegohaz
Copy link
Member

It seems that the SelectSeparator is deprecated already, but I can't find mention of it in the changelog.

Also, the SelectGroup example still uses it. https://ariakit.org/examples/select-group

We refer to this as "soft deprecation" to draw attention to it. However, it can still be reverted, and the change log entry will be added when it is finally deprecated with a console warning.

@jasikpark
Copy link

So the recommended replacement is meant to be a bottom border on each SelectGroup that emulates a separator? Definitely would be great to see an example in the docs by the time this is "hard deprecated"

@diegohaz
Copy link
Member

So the recommended replacement is meant to be a bottom border on each SelectGroup that emulates a separator? Definitely would be great to see an example in the docs by the time this is "hard deprecated"

Absolutely! Maybe an easier migration path is to just render a div or an aria-hidden hr instead, which will produce similar results to what you currently have with the separator component (but with a valid accessibility tree).

However, wrapping the items in a group is the ideal alternative because it better communicates to screen reader the separation of those items.

@diegohaz
Copy link
Member

Safari 17.4 will support <hr> elements within <select>, which is technically a role="separator" element inside a role="listbox". I'm not sure about the implications this holds for the accessibility tree, or if it signals future spec support for this relationship. However, it's worth noting.

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

No branches or pull requests

4 participants