Skip to content

Commit b3950d3

Browse files
google-labs-jules[bot]arii
authored andcommitted
feat(a11y): Add ARIA live regions for real-time updates
Implements ARIA live regions for the TimerDisplay and HrTile components to improve accessibility for screen reader users, addressing WCAG compliance for real-time data annunciation. This change adds 'aria-live="polite"' to the timer phase label and wraps the heart rate data in a container with 'aria-live="polite"' and 'aria-atomic="true"'. These changes ensure that critical state updates, such as Tabata phase changes and real-time heart rate data, are announced by screen readers.
1 parent 6c36198 commit b3950d3

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

components/HrTile.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// File: components/HrTile.tsx
22
'use client'
3+
import Box from '@mui/material/Box'
34
import CardContent from '@mui/material/CardContent'
45
import Tooltip from '@mui/material/Tooltip'
56
import Typography from '@mui/material/Typography'
@@ -34,10 +35,11 @@ const HrTile = ({ name, bpm, percentMax, background }: HrTileProps) => {
3435
justifyContent: 'center',
3536
}}
3637
>
37-
<CardContent sx={{ p: 0 }}>
38-
{/* Giant Percentage - should dominate the tile */}
39-
<Typography
40-
data-testid="live-hr-percent"
38+
<Box aria-live="polite" aria-atomic="true">
39+
<CardContent sx={{ p: 0 }}>
40+
{/* Giant Percentage - should dominate the tile */}
41+
<Typography
42+
data-testid="live-hr-percent"
4143
sx={{
4244
fontFamily: 'var(--font-roboto-mono), "Courier New", monospace',
4345
fontSize: { xs: '6rem', sm: '7rem', md: '8rem' },
@@ -77,6 +79,7 @@ const HrTile = ({ name, bpm, percentMax, background }: HrTileProps) => {
7779
</Typography>
7880
)}
7981
</CardContent>
82+
</Box>
8083
</StyledCard>
8184
</Tooltip>
8285
)

components/TimerDisplay.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ const TimerDisplay = ({
199199
<Typography
200200
data-testid="timer-phase-label"
201201
variant="h6"
202+
aria-live="polite"
202203
sx={{
203204
mb: 1,
204205
color: phaseColor,

0 commit comments

Comments
 (0)