Skip to content

Commit

Permalink
AKR:OTR:VKT:YKI(Frontend): Improve CircularStepper accessibility [dep…
Browse files Browse the repository at this point in the history
…loy]
  • Loading branch information
lket committed Sep 16, 2024
1 parent 6a586c2 commit 8b3b93f
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 25 deletions.
2 changes: 1 addition & 1 deletion frontend/packages/akr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"akr:tslint": "yarn g:tsc --pretty --noEmit"
},
"dependencies": {
"shared": "npm:@opetushallitus/[email protected].6"
"shared": "npm:@opetushallitus/[email protected].8"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Step, StepLabel, Stepper, Typography } from '@mui/material';

Check warning on line 1 in frontend/packages/akr/src/components/contactRequest/ContactRequestStepper.tsx

View workflow job for this annotation

GitHub Actions / frontend / common-frontend (20.9.0)

'Typography' is defined but never used. Allowed unused vars must match /^_/u
import { visuallyHidden } from '@mui/utils';
import { CircularStepper } from 'shared/components';
import { useWindowProperties } from 'shared/hooks';

Expand Down Expand Up @@ -48,12 +47,10 @@ export const ContactRequestStepper = () => {
<div aria-label={t('ariaLabel')} role="group">
<CircularStepper
value={value}
aria-hidden={true}
ariaLabel={ariaLabel}
phaseText={text}
size={90}
/>
<Typography sx={visuallyHidden}>{ariaLabel}</Typography>
</div>
) : (
<Stepper
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/otr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
"otr:tslint": "yarn g:tsc --pretty --noEmit"
},
"dependencies": {
"shared": "npm:@opetushallitus/[email protected].5"
"shared": "npm:@opetushallitus/[email protected].8"
}
}
4 changes: 4 additions & 0 deletions frontend/packages/shared/CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Released]

## [1.10.8] - 2024-09-16
### Fixed
- Improve CircularStepper accessibility

## [1.10.7] - 2024-08-07

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { CircularProgress, CircularProgressProps } from '@mui/material';
import { visuallyHidden } from '@mui/utils';

import { Text } from '../../components';
import { Color } from '../../enums/common';
import { H3 } from '../Text/Text';

import './CircularStepper.scss';

interface CircularStepperProps extends CircularProgressProps {
Expand All @@ -19,14 +22,16 @@ export const CircularStepper = ({
<div className="circular-stepper">
<CircularProgress
aria-label={ariaLabel}
aria-hidden={true}
className="circular-stepper__progress"
color={Color.Secondary}
variant="determinate"
{...rest}
/>
<div className="circular-stepper__heading">
<div className="circular-stepper__heading" aria-hidden={true}>
<H3>{phaseText}</H3>
</div>
<Text sx={visuallyHidden}>{ariaLabel}</Text>
</div>
);
};
2 changes: 1 addition & 1 deletion frontend/packages/vkt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
},
"dependencies": {
"reduxjs-toolkit-persist": "^7.2.1",
"shared": "npm:@opetushallitus/[email protected].7"
"shared": "npm:@opetushallitus/[email protected].8"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,14 @@ export const PublicEnrollmentStepper = ({

const stepValue = Math.min(activeStep, doneStepNumber);

const currentStep = `${t('currentStep')}: ${getDescription(stepValue)}.`;
const nextStep =
stepValue + 1 <= doneStepNumber
? `${t('nextStep')}: ${getDescription(stepValue + 1)}.`
: '';

const mobileStepValue = stepValue * (100 / doneStepNumber);
const mobilePhaseText = `${stepValue}/${doneStepNumber}`;
const mobileAriaLabel = `${getPhaseDescription(stepValue)}
${currentStep}
${nextStep}`;

return isPhone ? (
<div role="group" aria-label={t('phases')}>
<CircularStepper
value={mobileStepValue}
aria-hidden={true}
ariaLabel={mobileAriaLabel}
ariaLabel={getPhaseDescription(stepValue)}
phaseText={mobilePhaseText}
color={
activeStep === PublicEnrollmentFormStep.Payment
Expand All @@ -97,9 +87,6 @@ export const PublicEnrollmentStepper = ({
}
size={90}
/>
<Typography sx={visuallyHidden}>
{getPhaseDescription(stepValue)}
</Typography>
</div>
) : (
<Stepper
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/yki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"yki:tslint": "yarn g:tsc --pretty --noEmit"
},
"dependencies": {
"shared": "npm:@opetushallitus/[email protected].6"
"shared": "npm:@opetushallitus/[email protected].8"
},
"devDependencies": {
"multer": "^1.4.5-lts.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,13 @@ export const PublicRegistrationStepper = () => {
>
<CircularStepper
value={mobileStepValue}
aria-hidden={true}
ariaLabel={mobileAriaLabel}
phaseText={phaseText}
color={isError ? Color.Error : Color.Secondary}
size={90}
/>
<Text sx={visuallyHidden}>{mobileAriaLabel}</Text>
<div className="rows">
<Typography component="p" variant="h2">
<Typography component="p" variant="h2" aria-hidden={true}>
{getDescription(stepValue)}
</Typography>
{!isError && <Text>{getNextInformation(stepValue)}</Text>}
Expand Down

0 comments on commit 8b3b93f

Please sign in to comment.