Add a function that toggles all of the
Make a function to toggle the
aria-expandedvalue of a specific accordion button when it is clicked.
Now a screen reader will be able to communicate to screen reader users when an accordion is closed and can be opened (and vice versa).
In the video, I used
letto set a variable when I should have used
const, because it’s not being reassigned. You’ll be able to see this updated in the final CodePen. For a more detailed explanation on the differences, check out Wes Bos’s post on