fix(a11y): Quiz score is not announced to screen reader users after finishing a quiz
Describe the Issue
I am a blind user, and I use a screen reader. After finishing a quiz, the score message ("You have X out of Y questions correct.") is not announced by the screen reader, whether I pass or fail. The message is shown on the page, but I only find it by navigating to it.
When I pass, the completion modal opens at the same time as the score message appears. The screen reader only reads the modal, which does not include the score. To find out my score, I have to close the modal with Esc and then navigate through the page to find the score message below the questions.
When I fail, no completion modal opens, but the score is still not announced. I only find it by navigating to the end of the questions.
Sighted users can see their score right away, but screen reader users get no feedback about their result unless they know where to look for it.
Affected Page
Steps to Reproduce
- Using a screen reader, open any quiz, for example the affected page above.
- Answer all the questions.
- Activate the "Finish the quiz" button, and confirm in the "Finish Quiz" dialog.
- If you passed: the completion modal opens, and the screen reader reads the modal, but not the score. Close the modal with Esc: the score is still not announced.
- If you failed: no modal opens, and the score is not announced either.
- Navigate to the end of the questions: the message "You have X out of Y questions correct." is there, but it was never announced.
Expected behavior
After finishing a quiz, the screen reader should announce the score (for example, "You have 19 out of 20 questions correct."), both when passing and when failing. When passing, the completion modal could also include the score, so screen reader users hear it together with the completion message.
Screenshots
No response
System
- Device: [Laptop]
- OS: [Windows 11]
- Browser: [Chrome 154]
- Screen reader: [NVDA 2026.2]
Additional context
I tested this on the JavaScript Variables and Data Types Quiz, once failing (17 out of 20) and once passing (19 out of 20). I'm a screen reader user, and I'd like to work on a fix for this.
Source: freeCodeCamp/freeCodeCamp