Skip to content

Commit 366695f

Browse files
committed
YKI(Frontend): Construct aria-label for registration button from column header + actual CTA text.
1 parent 5692e16 commit 366695f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

frontend/packages/yki/src/components/registration/examSession/PublicExamSessionListingRow.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import { ExamSessionUtils } from 'utils/examSession';
2020

2121
const RegisterToExamButton = ({
2222
examSession,
23-
ariaLabel,
23+
ariaLabelPrefix,
2424
}: {
2525
examSession: ExamSession;
26-
ariaLabel?: string;
26+
ariaLabelPrefix?: string;
2727
}) => {
2828
const dispatch = useAppDispatch();
2929
const { t } = usePublicTranslation({
@@ -34,6 +34,12 @@ const RegisterToExamButton = ({
3434
const { availablePlaces, availableQueue } =
3535
ExamSessionUtils.getEffectiveRegistrationPeriodDetails(examSession);
3636

37+
const label = availablePlaces
38+
? t('register')
39+
: availableQueue
40+
? t('orderCancellationNotification')
41+
: t('full');
42+
3743
return (
3844
<CustomButtonLink
3945
color={Color.Secondary}
@@ -44,13 +50,9 @@ const RegisterToExamButton = ({
4450
}}
4551
to={AppRoutes.ExamSession.replace(/:examSessionId$/, `${examSession.id}`)}
4652
fullWidth={isPhone}
47-
aria-label={ariaLabel}
53+
aria-label={ariaLabelPrefix ? `${ariaLabelPrefix}: ${label}` : undefined}
4854
>
49-
{availablePlaces
50-
? t('register')
51-
: availableQueue
52-
? t('orderCancellationNotification')
53-
: t('full')}
55+
{label}
5456
</CustomButtonLink>
5557
);
5658
};
@@ -207,7 +209,7 @@ const PublicExamSessionListingCellsForPhone = ({
207209
{registerActionAvailable ? (
208210
<RegisterToExamButton
209211
examSession={examSession}
210-
ariaLabel={translateCommon('actions')}
212+
ariaLabelPrefix={translateCommon('actions')}
211213
/>
212214
) : (
213215
<Text

0 commit comments

Comments
 (0)