Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aria-live assertive for recording countdown #370

Merged
merged 6 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/LoadingDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const LoadingDialog = ({ headingId, isOpen }: LoadingDialogProps) => {
<FormattedMessage id={headingId} />
</ModalHeader>
<ModalBody>
<VStack gap={5} width="100%" alignItems="left">
<VStack gap={5} width="100%" alignItems="center">
<Text>
<FormattedMessage id="connectMB.connecting" />
</Text>
Expand Down
38 changes: 20 additions & 18 deletions src/components/RecordingDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ const RecordingDialog = ({
);
const countdownStages: CountdownStage[] = useMemo(
() => [
// Empty string state added to countdown because aria-live role region
// reads dynamic changes to region and not the initial contents.
{ value: "", duration: 500, fontSize: "8xl" },
microbit-robert marked this conversation as resolved.
Show resolved Hide resolved
{ value: 3, duration: 500, fontSize: "8xl" },
{ value: 2, duration: 500, fontSize: "8xl" },
{ value: 1, duration: 500, fontSize: "8xl" },
Expand Down Expand Up @@ -164,25 +167,24 @@ const RecordingDialog = ({
<ModalBody>
<VStack width="100%" alignItems="left" gap={5}>
<VStack height="100px" justifyContent="center">
{recordingStatus === RecordingStatus.Recording ? (
<Text
fontSize="5xl"
textAlign="center"
fontWeight="bold"
color="brand.500"
>
<Text
fontSize={
recordingStatus === RecordingStatus.Recording
? "5xl"
: countdownStages[countdownStageIndex].fontSize
}
textAlign="center"
fontWeight="bold"
color="brand.500"
role="region"
microbit-robert marked this conversation as resolved.
Show resolved Hide resolved
aria-live="assertive"
>
{recordingStatus === RecordingStatus.Recording ? (
<FormattedMessage id="content.data.recordingDialog.recording" />
</Text>
) : (
<Text
fontSize={countdownStages[countdownStageIndex].fontSize}
textAlign="center"
fontWeight="bold"
color="brand.500"
>
{countdownStages[countdownStageIndex].value}
</Text>
)}
) : (
countdownStages[countdownStageIndex].value
)}
</Text>
</VStack>
<Progress
alignSelf="center"
Expand Down
Loading