Skip to content

[Carousel] Accessibility improvments - v2#3018

Open
renow-luxembourg wants to merge 2 commits intoadobe:mainfrom
renow-luxembourg:renow_fix_carousel2
Open

[Carousel] Accessibility improvments - v2#3018
renow-luxembourg wants to merge 2 commits intoadobe:mainfrom
renow-luxembourg:renow_fix_carousel2

Conversation

@renow-luxembourg
Copy link
Contributor

Here is a simplify version of the following PR: #2930

This PR doesn't modify the DOM structure to avoid any backwards compatibility issues.

Suggestions that are regression-free to improve accessibility :

  • Add the title attribute to the action buttons (previous, next, play and pause)
  • Remove the double speech by deleting one of the aria-live attribute
  • Correct accessible name of the the tabpanel by removing the aria-labelledby attribute (an aria-label is already present)
  • Add the tabindex attribute to the tabpanel to improve the keyboard navigation
  • Initially add the tabindex and aria-selected attributes to the tab to improve the keyboard navigation
  • Add a title attribute to the indicator tabs buttons

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud
Copy link

id="${carousel.id}"
class="cmp-carousel"
role="group"
role="region"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching from role="group" to role="region" makes sense here since the carousel is a distinct section. Just wondering if we should ensure carousel.accessibilityLabel is always present so the region doesn’t end up unnamed for screen readers.

role="group"
role="region"
aria-label="${carousel.accessibilityLabel}"
aria-live="polite"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing aria-live="polite" seems like a good change. Auto-rotating carousels can otherwise keep announcing updates and become noisy for screen reader users.

id="${item.id}-tabpanel"
class="cmp-carousel__item${item.name == carousel.activeItem ? ' cmp-carousel__item--active' : ''}"
role="tabpanel"
aria-labelledby="${item.id}-tab"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new "Slide X of Y" label is clearer than relying on aria-labelledby. Quick question: does itemList.count start at 1 here? Just checking to avoid the first slide being announced as “Slide 0”.

data-cmp-data-layer="${item.data.json}"
data-cmp-hook-carousel="item"></div>
data-cmp-hook-carousel="item"
tabindex="-1"></div>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed tabindex="-1" was added to the slide container. Is this used for programmatic focus when slides change? Just wanted to confirm the intent.

<button class="cmp-carousel__action cmp-carousel__action--previous"
type="button"
aria-label="${carousel.accessibilityPrevious || 'Previous' @ i18n}"
title="${carousel.accessibilityPrevious || 'Previous' @ i18n}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the title attribute on the navigation buttons looks helpful for hover tooltips. Since we already have aria-label, this shouldn’t affect accessibility behavior, right?

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.

3 participants