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

CIF-2279 - Improve accessibility of carousel components #666

Merged
merged 3 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -14,7 +14,7 @@
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
<template data-sly-template.card="${@ item}">
<div role="displaycard" class="card carousel__card">
<div class="card carousel__card">
<div>${item}</div>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
<sly data-sly-test.type="${componentType ? componentType : 'carousel'}" />
<div id="${carousel.id}" data-comp-is="${type}" class="${type}__container" data-cmp-data-layer="${carousel.data.json}">
<h2 data-sly-element="${carousel.titleType}" data-sly-test="${properties.jcr:title}" class="${type}__title">${properties.jcr:title}</h2>
<button data-carousel-action='prev' class="${type}__btn ${type}__btn--prev" type="button" style="display: none;"></button>
<button data-carousel-action='prev' class="${type}__btn ${type}__btn--prev" type="button" title="${'Show previous' @ i18n}" aria-label="${'Show previous' @ i18n}" style="display: none;"></button>
<button data-carousel-action='next' class="${type}__btn ${type}__btn--next" type="button" title="${'Show next' @ i18n}" aria-label="${'Show next' @ i18n}" style="display: none;"></button>
<div class="${type == 'carousel' ? '{0}__cardsroot' : '{0}__root' @ format=[type]}">
<div class="${type}__parent">
<div class="${type}__cardscontainer" data-sly-list.item="${items ? items : carousel.items}">
<sly data-sly-call="${cardTpl.card @ item=item}"/>
</div>
</div>
</div>
<button data-carousel-action='next' class="${type}__btn ${type}__btn--next" type="button" style="display: none;"></button>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@
position: absolute;
top: 50%;
width: 20px;
color: dimgrey;
border-color: dimgrey;
}

.carousel__btn:focus-visible {
border-color: black;
}

.carousel__btn:disabled {
border-color: lightgrey;
}

.carousel__btn--next {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
<template data-sly-template.card="${@ item}">
<div role="displaycard" class="card carousel__card categorycarousel__card">
<div class="card carousel__card categorycarousel__card">
<a class="categorycarousel__anchor" href="${item.path}">
<span data-sly-test.hasImage=${item.image} class="categorycarousel__imagewrapper" style="background-image: url(${item.image @context='uri'});">
<img class="categorycarousel__image" src='${item.image}' alt="${item.name}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@
position: absolute;
top: 50%;
width: 20px;
color: dimgrey;
border-color: dimgrey;
}

.productcarousel__btn:focus-visible {
border-color: black;
}

.productcarousel__btn:disabled {
border-color: lightgrey;
}

.productcarousel__btn--next {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
<template data-sly-template.productcard="${@ product}">
<div role="displaycard"
data-product-sku="${product.commerceIdentifier.value}"
<div data-product-sku="${product.commerceIdentifier.value}"
id="${product.id}"
data-cmp-data-layer="${product.data.json}"
class="card product__card">
<a href="${product.URL}">
<div class="product__card__image">
<img class="product__image" src="${product.imageURL}" alt="${product.imageAlt}" data-gallery-role="currentimage"/>
<img class="product__image" src="${product.imageURL}" alt="${product.imageAlt}" />
buuhuu marked this conversation as resolved.
Show resolved Hide resolved
</div>
<div>${product.Title}</div>
<sly data-sly-use.template="core/cif/components/commons/v1/price.html"
Expand Down
16 changes: 8 additions & 8 deletions ui.apps/test/components/commerce/carousel/carouselTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,32 @@ describe('Carousel', () => {
<div class="carousel aem-GridColumn aem-GridColumn--default--12">
<div data-comp-is="carousel" class="carousel__container">
<h2 class="carousel__title">Shop by category</h2>
<button data-carousel-action="prev" class="carousel__btn carousel__btn--prev" type="button" style="display: block;"disabled=""></button>
<button data-carousel-action="prev" class="carousel__btn carousel__btn--prev" type="button" title="Show previous" aria-label="Show previous" style="display: block;"disabled=""></button>
<button data-carousel-action="next" class="carousel__btn carousel__btn--next" type="button" title="Show next" aria-label="Show next" style="display: block;"></button>
<div class="carousel__cardsroot">
<div class="carousel__parent">
<div class="carousel__cardscontainer" style="width: 1440px; transition: margin-left 300ms linear 0ms; margin-left: 0px;">
<div role="displaycard" class="card carousel__card">
<div class="card carousel__card">
<div>Card 1</div>
</div>
<div role="displaycard" class="card carousel__card">
<div class="card carousel__card">
<div>Card 2</div>
</div>
<div role="displaycard" class="card carousel__card">
<div class="card carousel__card">
<div>Card 3</div>
</div>
<div role="displaycard" class="card carousel__card">
<div class="card carousel__card">
<div>Card 4</div>
</div>
<div role="displaycard" class="card carousel__card">
<div class="card carousel__card">
<div>Card 5</div>
</div>
<div role="displaycard" class="card carousel__card">
<div class="card carousel__card">
<div>Card 6</div>
</div>
</div>
</div>
</div>
<button data-carousel-action="next" class="carousel__btn carousel__btn--next" type="button" style="display: block;"></button>
</div>
</div>
`
Expand Down