Skip to content

Commit

Permalink
Improve clues A11y (#1942)
Browse files Browse the repository at this point in the history
Add answer correct to the screen reader span for the Clues
  • Loading branch information
oliverabrahams authored Feb 12, 2025
1 parent f846b5c commit 67db8d9
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions libs/@guardian/react-crossword/src/components/Clue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const ClueComponent = ({
}: Props) => {
const theme = useTheme();
const { validAnswers } = useValidAnswers();

const isValid = validAnswers.has(entry.id);
return (
<div
data-entry-id={entry.id}
Expand All @@ -79,10 +79,6 @@ const ClueComponent = ({
padding: 0.5em 0;
color: currentColor;
.visuallyHidden {
${visuallyHidden}
}
@media print {
padding: 0.125em 0;
background-color: transparent;
Expand Down Expand Up @@ -112,9 +108,9 @@ const ClueComponent = ({
}}
></span>
<span css={css(visuallyHidden)}>
{`${formatNumberForScreenReader(entry.humanNumber, entry.direction)} ${formatClueForScreenReader(entry.clue)}`}
{`${isValid ? 'Answer correct.' : ''} ${formatNumberForScreenReader(entry.humanNumber, entry.direction)} ${formatClueForScreenReader(entry.clue)}`}
</span>
{validAnswers.has(entry.id) && (
{isValid && (
<span
css={css`
display: table-cell;
Expand Down

0 comments on commit 67db8d9

Please sign in to comment.