Open huyenltnguyen opened 4 days ago
This isn't a bug in the component, but in this Storybook demo: https://opensource.freecodecamp.org/ui/?path=/story/components-quiz--with-validation.
In the demo, we only want to display the correct answer count on submit, but the number shows up on the screen on load:
Code:
https://github.com/freeCodeCamp/ui/blob/f23cd2833eecd2248b84f6d3be93267f27c62989/src/quiz/quiz.stories.tsx#L106
While we're at it, we should improve the accessibility of the correct count message as well. In order for screen readers to pick up the message, it should be placed inside a live region:
<div aria-live="polite"> <p>Correct answers: {correctAnswerCount}</p> </div>
Update the rendering logic to:
I am getting these weird errors and can't contribute.
Edit: This happens on WSL 2. Looks like Windows standalone may be fine.
Description
This isn't a bug in the component, but in this Storybook demo: https://opensource.freecodecamp.org/ui/?path=/story/components-quiz--with-validation.
In the demo, we only want to display the correct answer count on submit, but the number shows up on the screen on load:
Screenshot
![Image](https://github.com/user-attachments/assets/2734915d-ccb1-4b60-a593-f93e3b5066e4)Code:
https://github.com/freeCodeCamp/ui/blob/f23cd2833eecd2248b84f6d3be93267f27c62989/src/quiz/quiz.stories.tsx#L106
While we're at it, we should improve the accessibility of the correct count message as well. In order for screen readers to pick up the message, it should be placed inside a live region:
Changes needed
Update the rendering logic to: