Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
data-panelcontainer="${wcmmode.edit && 'carousel'}"
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.

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.

aria-roledescription="carousel"
data-cmp-is="carousel"
data-cmp-autoplay="${(wcmmode.edit || wcmmode.preview) ? '' : carousel.autoplay}"
Expand All @@ -40,11 +39,11 @@
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”.

aria-roledescription="slide"
aria-label="${(carousel.accessibilityAutoItemTitles && item.title) || 'Slide {0} of {1}' @ format=[itemList.count, carousel.items.size], i18n}"
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.

<sly data-sly-call="${controlsTemplate.controls @ carousel=carousel}" data-sly-test="${!carousel.controlsPrepended}"></sly>
<ol class="cmp-carousel__indicators"
role="tablist"
Expand All @@ -53,9 +52,12 @@
<li data-sly-repeat.item="${items}"
id="${item.id}-tab"
class="cmp-carousel__indicator${item.name == carousel.activeItem ? ' cmp-carousel__indicator--active' : ''}"
role="tab"
role="tab"
aria-controls="${item.id}-tabpanel"
aria-label="${'Slide {0}' @ format=[itemList.count], i18n}"
aria-label="${'Slide {0}' @ format=[itemList.count], i18n} ${item.title}"
title="${'Slide {0}' @ format=[itemList.count], i18n} ${item.title}"
tabindex="${item.name == carousel.activeItem ? '0' : '-1'}"
aria-selected="${item.name == carousel.activeItem ? 'true' : 'false'}"
data-cmp-hook-carousel="indicator">${item.title}</li>
</ol>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
<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?

data-cmp-hook-carousel="previous">
<span class="cmp-carousel__action-icon"></span>
<span class="cmp-carousel__action-text">${carousel.accessibilityPrevious || 'Previous' @ i18n}</span>
</button>
<button class="cmp-carousel__action cmp-carousel__action--next"
type="button"
aria-label="${carousel.accessibilityNext || 'Next' @ i18n}"
title="${carousel.accessibilityNext || 'Next' @ i18n}"
data-cmp-hook-carousel="next">
<span class="cmp-carousel__action-icon"></span>
<span class="cmp-carousel__action-text">${carousel.accessibilityNext || 'Next' @ i18n}</span>
Expand All @@ -34,6 +36,7 @@
class="cmp-carousel__action cmp-carousel__action--pause"
type="button"
aria-label="${carousel.accessibilityPause || 'Pause' @ i18n}"
title="${carousel.accessibilityPause || 'Pause' @ i18n}"
data-cmp-hook-carousel="pause">
<span class="cmp-carousel__action-icon"></span>
<span class="cmp-carousel__action-text">${carousel.accessibilityPause || 'Pause' @ i18n}</span>
Expand All @@ -42,6 +45,7 @@
class="cmp-carousel__action cmp-carousel__action--play cmp-carousel__action--disabled"
type="button"
aria-label="${carousel.accessibilityPlay || 'Play' @ i18n}"
title="${carousel.accessibilityPlay || 'Play' @ i18n}"
data-cmp-hook-carousel="play">
<span class="cmp-carousel__action-icon"></span>
<span class="cmp-carousel__action-text">${carousel.accessibilityPlay || 'Play' @ i18n}</span>
Expand Down
Loading