Skip to content

Commit 7fd1070

Browse files
author
Kubit
committed
Include aria-live prop to Carousel
1 parent a6f6e60 commit 7fd1070

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

src/components/carousel/carouselStandAlone.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ const CarouselStandAloneComponent = (
111111
>
112112
<CarouselContentStyled
113113
ref={carouselContentRef}
114-
aria-live={playing ? AriaLiveOptionType.OFF : AriaLiveOptionType.POLITE}
114+
aria-live={
115+
props['aria-live'] ?? (playing ? AriaLiveOptionType.OFF : AriaLiveOptionType.POLITE)
116+
}
115117
centerMode={centerMode}
116118
data-testid={`${dataTestId}Content`}
117119
disableSwipe={disableSwipe}

src/components/carousel/stories/argtypes.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export const argtypes = (variants: IThemeObjectVariants, themeSelected: string):
223223
},
224224
},
225225
['aria-labelledby']: {
226-
description: 'Carousel aria label by',
226+
description: 'Carousel aria labelledby',
227227
type: { name: 'string' },
228228
control: { type: 'text' },
229229
table: {
@@ -233,6 +233,17 @@ export const argtypes = (variants: IThemeObjectVariants, themeSelected: string):
233233
category: CATEGORY_CONTROL.ACCESIBILITY,
234234
},
235235
},
236+
['aria-live']: {
237+
description: 'Aria live applied to carousel content',
238+
control: { type: 'text' },
239+
type: { name: 'string' },
240+
table: {
241+
type: {
242+
summary: 'string',
243+
},
244+
category: CATEGORY_CONTROL.ACCESIBILITY,
245+
},
246+
},
236247
displayArrowsOnCarousel: {
237248
description: 'Show the arrows on the carousel or on the Page Control',
238249
type: { name: 'boolean' },

src/components/carousel/types/carousel.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ export type PageControlAutomateConfigType = Omit<
2323
mediaProgressBar: CarouselMediaProgressBarType;
2424
};
2525

26-
export interface ICarouselStandAlone {
27-
['aria-labelledby']?: string;
26+
type CarouselAriaAttributes = Pick<React.AriaAttributes, 'aria-labelledby' | 'aria-live'>;
27+
28+
export interface ICarouselStandAlone extends CarouselAriaAttributes {
2829
styles: CarouselPropsStylesType;
2930
carouselContainerRef: React.RefObject<HTMLDivElement>;
3031
carouselContentRef: React.RefObject<HTMLDivElement>;

0 commit comments

Comments
 (0)