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

Question: Accessibility #32

Open
freddi301 opened this issue Oct 3, 2024 · 4 comments
Open

Question: Accessibility #32

freddi301 opened this issue Oct 3, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@freddi301
Copy link

Hi, this component is exactly what I need. But is it accessible?

@richardscarrott
Copy link
Owner

Hi @freddi301 -- react-snap-carousel has a few advantages re: accessibility.

  1. It's headless so you can markup the content however you see fit.
  2. It uses native scrolling which most (all?) assistive technology should be comfortable navigating.

Personally I've only ever tested using VoiceOver for macOS which is more than capable of navigating the content in the carousel.

I've found it's best to simply hide the controls from screen readers as they aren't essential to navigation -- a user can just scroll using whatever input they prefer (mouse, trackpad, touch, screen reader etc.) -- in fact, without additional markup they just confuse screen readers in my experience.

e.g.

<div aria-hidden>
  <PrevButton />
  <Pagination />
  <NextButton />
</div>

@freddi301
Copy link
Author

would you add an accessibility tips section to the readme? just copy pasting your answer is enough IMHO.
I agree contents are already accessible. from a brief analysis making controls accessible has not really a meaning: scroll controls are not useful for a screen reader, and this use case does not map to traditional pagination.
The only other thing that bothers me if the user uses tab to navigate the pagination controls, when he goes back to the content, it would scroll him to the beginning.
Feel free to close the issue if you don't think these are worth addressing.
Great work, best regards

@richardscarrott richardscarrott added the documentation Improvements or additions to documentation label Oct 9, 2024
@jonmilner
Copy link

I've found it's best to simply hide the controls from screen readers as they aren't essential to navigation -- a user can just scroll using whatever input they prefer (mouse, trackpad, touch, screen reader etc.) -- in fact, without additional markup they just confuse screen readers in my experience.

my understanding is that focusable elements (or elements that contain focusable elements) shouldn't use aria-hidden, because the elements remain focusable via keyboard navigation (but remain silent to screen readers, presumably causing more confusion).

it also appears it could be considered a level A violation (4.2.1)

one way to get around this could be to set the buttons and pagination to display: none unless the carousel is being hovered. assuming the carousel items are focusable (or have focusable children), tabbing through the items should in theory scroll the focused item into view, therefore remaining accessible via keyboard navigation.

@richardscarrott
Copy link
Owner

richardscarrott commented Feb 27, 2025

@jonmilner yeah I recall coming across the issue with aria-hidden and focusable elements when I last looked at this. I don't think adding display: none to the controls is a good idea as spoils the experience for everybody. I was hoping there was a media query to check if a screen reader is being used but AFAICT this doesn't exist.

I guess my original advice of adding aria-hidden was only really considering unsighted users and not considering partially sighted users who can potentially see the controls but still use a screen reader so it could be confusing.

It might be worth trying to make the controls accessible -- ultimately, I think you'd need to make sure the screen reader knows which elements in the list have become active as a result of navigating using the controls. I wonder if adding aria-current or aria-selected to the elements in the current 'page' would work?

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

No branches or pull requests

3 participants