Skip to content

Carousel accessibility#2353

Merged
claviska merged 3 commits intoshoelace-style:nextfrom
rothy-s:carousel-accessibility
Feb 3, 2025
Merged

Carousel accessibility#2353
claviska merged 3 commits intoshoelace-style:nextfrom
rothy-s:carousel-accessibility

Conversation

@doctor-spaceman
Copy link
Contributor

@doctor-spaceman doctor-spaceman commented Jan 21, 2025

This PR addresses the following (discussion) (issue)

When pagination is enabled:

  • Add role="tabpanel" to each sl-carousel-item.
  • Add an id to each sl-carousel-item that can be referenced by the aria-controls attribute on each tab.
  • Remove aria-controls from the pagination part, adding it to each tab element instead, and populating it with the corresponding id of each tabpanel .
  • Add an id to each tab.
  • Add aria-labelledby to each sl-carousel-item and populate it with the id of the corresponding tab.
  • Tab labelling: The active tab shouldn't have a label saying "Go to slide {{ active slide number }} of {{ total slides }}" because the tab is already focused.

The following items are not addressed, since this would touch translation files.

  • Tab labelling: The tablist role already provides the number of tabs in the list, so its not necessary to include this in the label. The labeling could be "Go to Slide 2" which the screen reader would announce as "Go to Slide 2, tab selected 1 of 7".

References:

MDN: tab role
MDN: tab role example
MDN: tab panel role
MDN: tablist role
MDN: aria-controls

@vercel
Copy link

vercel bot commented Jan 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
shoelace ❌ Failed (Inspect) Jan 21, 2025 7:41pm

@claviska
Copy link
Member

claviska commented Feb 3, 2025

Sorry, I had to revert this PR. I fixed the missing param in localize and made eslint happy, but there were a number of failing tests. Even after updating them, the bulit-in axe test failed.

If you'd like to submit a fresh PR, we can look at it together to get it over the finish line.

@doctor-spaceman
Copy link
Contributor Author

Sorry, I had to revert this PR. I fixed the missing param in localize and made eslint happy, but there were a number of failing tests. Even after updating them, the bulit-in axe test failed.

If you'd like to submit a fresh PR, we can look at it together to get it over the finish line.

Sorry about that! Happy to do so. Can you point me at any details for the failed test?

@doctor-spaceman
Copy link
Contributor Author

New PR

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants