Skip to content

Commit 2374bf6

Browse files
authored
fix: Banner Carousel accessibility adjustments (kyma-project#4192)
1 parent 4b3f68f commit 2374bf6

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

public/i18n/en.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ common:
418418
days-ago: days ago
419419
'yes': 'yes'
420420
components:
421+
banner-carousel: Banner Carousel
421422
dropdown:
422423
empty-list: No resources available
423424
error-panel:

src/shared/components/FeatureCard/BannerCarousel.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { ReactNode, useEffect, useRef, useState } from 'react';
22
import { Carousel } from '@ui5/webcomponents-react';
3+
import { useTranslation } from 'react-i18next';
34

45
export default function BannerCarousel({ children }: { children: ReactNode }) {
6+
const { t } = useTranslation();
57
const carouselRef = useRef<React.ElementRef<typeof Carousel>>(null);
68
const [childrenLength, setChildrenLength] = useState(0);
79
const [activeIndex, setActiveIndex] = useState(0);
@@ -48,6 +50,7 @@ export default function BannerCarousel({ children }: { children: ReactNode }) {
4850
}}
4951
onMouseEnter={handleMouseEnter}
5052
onMouseLeave={handleMouseLeave}
53+
accessibleName={t('components.banner-carousel')}
5154
>
5255
{children}
5356
</Carousel>

src/shared/components/FeatureCard/FeatureCard.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from './types';
1818

1919
import './FeaturedCard.scss';
20+
import { useTranslation } from 'react-i18next';
2021

2122
const getIllustration = (
2223
illustration: IllustrationType,
@@ -64,6 +65,7 @@ export function FeatureCardBanner({
6465
titleIcon,
6566
className = '',
6667
}: FeatureCardBannerProps) {
68+
const { t } = useTranslation();
6769
const [hideBanner, setHideBanner] = useState(false);
6870
const hideBannerKey = `hideBanner${id}`;
6971
const theme = useAtomValue(themeAtom);
@@ -107,6 +109,7 @@ export function FeatureCardBanner({
107109
icon="decline"
108110
className="decline-button"
109111
onClick={handleToggle}
112+
accessibleName={t('common.buttons.close')}
110113
/>
111114
<div className="outer-container">
112115
<div className="inner-container">

src/shared/components/FeatureCard/FeaturedCard.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
}
1010

1111
.banner-carousel {
12+
position: relative;
13+
top: 2px;
14+
left: 2px;
1215
height: fit-content;
13-
width: calc(100% - 1px);
16+
width: calc(100% - 4px);
1417
}
1518

1619
.feature-card {

0 commit comments

Comments
 (0)