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

fix: (CXSPA-9071) - Add aria-label for the buttons in ProductImageZoomView #19726

Merged
merged 4 commits into from
Dec 6, 2024
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 @@ -4,6 +4,8 @@
},
"productImageZoomDialog": {
"zoomedInImage": "Zoomed in image",
"previousSlide": "Previous slide",
"nextSlide": "Next slide",
"close": "Close"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<ng-container *ngIf="mainImage$ | async as main">
<div class="cx-main-image-group" *ngIf="thumbnails$ | async as thumbs">
<div class="cx-navigate-image">
<div class="cx-navigate-image" aria-labelledby="previouButton">
Copy link
Contributor

Choose a reason for hiding this comment

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

This will likely result in the label being repeated twice. Is the aria-label on the button itself not enough?

<button
class="btn btn-link"
id="previouButton"
[attr.aria-label]="'productImageZoomDialog.previousSlide' | cxTranslate"
[attr.title]="'productImageZoomDialog.previousSlide' | cxTranslate"
*ngIf="getPreviousProduct(thumbs) | async as previousProduct"
(click)="openImage(previousProduct.container)"
>
Expand Down Expand Up @@ -78,9 +81,12 @@
>
</cx-media></div
></ng-container>
<div class="cx-navigate-image">
<div class="cx-navigate-image" aria-labelledby="nextButton">
<button
id="nextButton"
class="btn btn-link"
[attr.aria-label]="'productImageZoomDialog.nextSlide' | cxTranslate"
[attr.title]="'productImageZoomDialog.nextSlide' | cxTranslate"
*ngIf="getNextProduct(thumbs) | async as nextProduct"
(click)="openImage(nextProduct.container)"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { By } from '@angular/platform-browser';
import {
FeatureConfigService,
FeaturesConfigModule,
I18nTestingModule,
ImageGroup,
Product,
} from '@spartacus/core';
Expand All @@ -26,6 +27,7 @@ import {
CurrentProductService,
} from '@spartacus/storefront';
import { EMPTY, Observable, of } from 'rxjs';

import { ProductImageZoomViewComponent } from './product-image-zoom-view.component';

const firstImage = {
Expand Down Expand Up @@ -134,7 +136,7 @@ describe('ProductImageZoomViewComponent', () => {

beforeEach(async () => {
TestBed.configureTestingModule({
imports: [FeaturesConfigModule],
imports: [I18nTestingModule, FeaturesConfigModule],
declarations: [
ProductImageZoomViewComponent,
MockIconComponent,
Expand Down
Loading