Skip to content

Commit

Permalink
feat(storefront): BCTHEME-344 Carousel buttons do not receive focus (b…
Browse files Browse the repository at this point in the history
  • Loading branch information
yurytut1993 authored and sacr3dc0w committed Mar 31, 2021
1 parent 60c1fb0 commit 572ae7b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Carousel buttons do not receive focus. [#1937](https://github.com/bigcommerce/cornerstone/pull/1937)
- Empty cart message not read by screen reader. [#1935](https://github.com/bigcommerce/cornerstone/pull/1935)
- No tooltips provided for carousel buttons. [#1934](https://github.com/bigcommerce/cornerstone/pull/1934)
- Added announcement on shipping estimator errors. [#1932](https://github.com/bigcommerce/cornerstone/pull/1932)
Expand Down
2 changes: 1 addition & 1 deletion assets/js/theme/common/carousel/utils/setTabindexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default ($slides, $prevArrow, $nextArrow, actualSlide, actualSlideCount)
$slides.each((index, element) => {
const $element = $(element);
const tabIndex = $element.hasClass('slick-active') ? 0 : -1;
if (!$element.hasClass('js-product-slide')) {
if ($element.attr('href') !== undefined) {
$element.attr('tabindex', tabIndex);
}

Expand Down
2 changes: 1 addition & 1 deletion templates/components/carousel-content.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<span class="heroCarousel-title">{{{heading}}}</span>
<p class="heroCarousel-description">{{{text}}}</p>
{{#if button_text}}
<span class="heroCarousel-action button button--primary button--large">{{button_text}}</span>
<a href="{{url}}" aria-label="{{#if this.alt_text.length '!=' 0}}{{this.alt_text}}{{else}}{{lang 'common.carousel_slide_number' slide_number=(add @index 1)}}{{/if}}, {{button_text}}" class="heroCarousel-action button button--primary button--large">{{button_text}}</a>
{{/if}}
</div>
8 changes: 8 additions & 0 deletions templates/components/carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
<button aria-label="{{lang 'carousel.arrowAriaLabel'}} {{carousel.slides.length}}" class="js-hero-prev-arrow slick-prev slick-arrow"></button>
{{/and}}
{{#each carousel.slides}}
{{#if button_text}}
<div class="js-hero-slide">
{{else}}
<a href="{{url}}" class="js-hero-slide" aria-label="{{#if this.alt_text.length '!=' 0}}{{this.alt_text}}{{else}}{{lang 'common.carousel_slide_number' slide_number=(add @index 1)}}{{/if}}">
{{/if}}
<div class="heroCarousel-slide {{#if ../theme_settings.homepage_stretch_carousel_images}}stretch{{/if}} {{#if @first}}heroCarousel-slide--first{{/if}}">
<div class="heroCarousel-image-wrapper">
{{#if @first}}
Expand Down Expand Up @@ -50,7 +54,11 @@
{{/if}}
{{/if}}
</div>
{{#if button_text}}
</div>
{{else}}
</a>
{{/if}}
{{/each}}
{{#and arrows (if carousel.slides.length '>' 1)}}
<button aria-label="{{lang 'carousel.arrowAriaLabel'}} {{carousel.slides.length}}" class="js-hero-next-arrow slick-next slick-arrow"></button>
Expand Down

0 comments on commit 572ae7b

Please sign in to comment.