Skip to content

Commit 8bca3c8

Browse files
committed
Site Overview: label setup progress by description, add steps-complete valuetext
1 parent f12c573 commit 8bca3c8

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

client/dashboard/components/overview-card/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
import { isRTL, __ } from '@wordpress/i18n';
1212
import { chevronLeft, chevronRight } from '@wordpress/icons';
1313
import clsx from 'clsx';
14+
import { useId } from 'react';
1415
import { useAnalytics } from '../../app/analytics';
1516
import { Card, CardBody } from '../../components/card';
1617
import { isOnboardingUrl, isRelativeUrl } from '../../utils/url';
@@ -29,7 +30,7 @@ export interface OverviewCardProps {
2930
value: number;
3031
max: number;
3132
label: string;
32-
ariaLabel?: string;
33+
ariaValueText?: string;
3334
variant?: ComponentProps< typeof CircularProgressBar >[ 'variant' ];
3435
};
3536
intent?: 'activate' | 'upsell' | 'success' | 'warning' | 'error';
@@ -75,6 +76,7 @@ export default function OverviewCard( {
7576
onClick,
7677
}: OverviewCardProps ) {
7778
const { recordTracksEvent } = useAnalytics();
79+
const descriptionId = useId();
7880

7981
const renderHeading = () => {
8082
if ( isLoading ) {
@@ -165,6 +167,7 @@ export default function OverviewCard( {
165167
{ renderHeading() }
166168
</Heading>
167169
<Text
170+
id={ descriptionId }
168171
intent={ intent === 'warning' || intent === 'error' ? intent : undefined }
169172
variant={ intent === 'warning' || intent === 'error' ? undefined : 'muted' }
170173
lineHeight="16px"
@@ -177,7 +180,8 @@ export default function OverviewCard( {
177180
</VStack>
178181
{ progress && (
179182
<CircularProgressBar
180-
ariaLabel={ progress.ariaLabel }
183+
ariaLabelledBy={ description ? descriptionId : undefined }
184+
ariaValueText={ progress.ariaValueText }
181185
currentStep={ progress.value }
182186
numberOfSteps={ progress.max }
183187
size={ 80 }

client/dashboard/sites/overview-visibility-card/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { siteLaunchpadQuery } from '@automattic/api-queries';
22
import { useQuery } from '@tanstack/react-query';
3-
import { __ } from '@wordpress/i18n';
3+
import { __, sprintf } from '@wordpress/i18n';
44
import { lockOutline, published } from '@wordpress/icons';
55
import { LAUNCHPAD_PERSONALIZATION_EXPERIMENT, normalizeVariation } from 'calypso/lib/ai-launchpad';
66
import { useExperiment } from 'calypso/lib/explat';
@@ -83,7 +83,12 @@ function VisibilityCardUnlaunched( { site }: { site: Site } ) {
8383
value: completedTasks,
8484
max: numberOfTasks,
8585
label: `${ completedTasks }/${ numberOfTasks }`,
86-
ariaLabel: __( 'Steps to launch your site' ),
86+
ariaValueText: sprintf(
87+
/* translators: %1$d: number of completed steps, %2$d: total number of steps. e.g. "2 of 5 steps complete" */
88+
__( '%1$d of %2$d steps complete' ),
89+
completedTasks,
90+
numberOfTasks
91+
),
8792
...( isLaunchpadCompleted && { variant: 'success' as const } ),
8893
} }
8994
/>

0 commit comments

Comments
 (0)