Skip to content

Commit 18b7b89

Browse files
authored
Merge pull request #15389 from guardian/doml/highlights-carousel-accessibility
Add carousel aria attributes to highlights container
2 parents 164adb9 + a8663eb commit 18b7b89

3 files changed

Lines changed: 19 additions & 10 deletions

File tree

dotcom-rendering/src/components/Card/Card.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export type Props = {
141141
/** The index of the card in a carousel */
142142
index?: number;
143143
/**
144-
* Useful for videos. Has the form: collection-{collection ID}-{card grouping type}-{card index}
144+
* Useful for IDs. Has the form: collection-{collection ID}-{card grouping type}-{card index}
145145
* For example, the first splash card in the second collection would be: "collection-1-splash-0"
146146
*/
147147
uniqueId?: string;
@@ -152,7 +152,7 @@ export type Props = {
152152
showTopBarDesktop?: boolean;
153153
showTopBarMobile?: boolean;
154154
trailTextSize?: TrailTextSize;
155-
/** A kicker image is seperate to the main media and renders as part of the kicker */
155+
/** A kicker image is separate to the main media and renders as part of the kicker */
156156
showKickerImage?: boolean;
157157
subtitleSize?: SubtitleSize;
158158
/** Determines if the headline should be positioned within the content or outside the content */

dotcom-rendering/src/components/ScrollableHighlights.importable.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,23 +268,32 @@ export const ScrollableHighlights = ({ trails, frontId }: Props) => {
268268
getOphanInfo(frontId);
269269

270270
return (
271-
<div css={containerStyles} data-link-name={ophanFrontName}>
272-
<ol
273-
data-link-name={ophanComponentLink}
274-
data-component={ophanComponentName}
275-
data-container-name={'scrollable/highlights'}
271+
<div
272+
css={containerStyles}
273+
data-link-name={ophanFrontName}
274+
role="region"
275+
aria-roledescription="carousel"
276+
aria-label="Highlights"
277+
aria-live="polite"
278+
>
279+
<ul
276280
ref={carouselRef}
277281
css={[
278282
carouselStyles,
279283
generateCarouselColumnStyles(carouselLength),
280284
]}
285+
data-link-name={ophanComponentLink}
286+
data-component={ophanComponentName}
287+
data-container-name="scrollable/highlights"
281288
data-heatphan-type="carousel"
282289
>
283290
{trails.map((trail) => {
284291
return (
285292
<li
286293
key={trail.url}
287294
css={[itemStyles, verticalLineStyles]}
295+
role="group"
296+
aria-roledescription="slide"
288297
>
289298
<HighlightsCard
290299
format={trail.format}
@@ -304,7 +313,7 @@ export const ScrollableHighlights = ({ trails, frontId }: Props) => {
304313
</li>
305314
);
306315
})}
307-
</ol>
316+
</ul>
308317

309318
<Hide until="tablet">
310319
{showPreviousButton && (

dotcom-rendering/src/components/SlideshowCarousel.importable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export const SlideshowCarousel = ({
291291
}
292292
size="small"
293293
disabled={!previousButtonEnabled}
294-
aria-label="View next image in slideshow"
294+
aria-label="Previous image"
295295
// TODO: data-link-name="slideshow carousel left chevron"
296296
/>
297297

@@ -308,7 +308,7 @@ export const SlideshowCarousel = ({
308308
}
309309
size="small"
310310
disabled={!nextButtonEnabled}
311-
aria-label="View previous image in slideshow"
311+
aria-label="Next image"
312312
// TODO: data-link-name="slideshow carousel right chevron"
313313
/>
314314
</div>

0 commit comments

Comments
 (0)