@AnaCarol2001
Posted
Hey, good job with your solution!
About your accessibility concerns, since you used the details
and summary
tags, you don't need the aria-expanded
and aria-controls
because details
already provide an accessible description.
I don't know much about screen readers. So, after testing your project and comparing it to the details
examples provided by MDN docs with NVDA in Firefox, it seems to work as expected. The screen reader announces that it is clickable, and when clicked, it announces that it's expanded, and with the arrow down key or NVDA+downArrowKey, you can keep reading and access the information.
As far as I know, the screen reader shouldn't read the content immediately but announce the element's state (collapsed or not collapsed), and the user will keep reading.
Accessible description - MDN Stackoverflow answer about screen reader reading new content ('Simply read on' part talks about aria-expanded)
Marked as helpful
@kaamiik
Posted
Thanks for your good feedback @AnaCarol2001 Yes, you are absolutely right. The truth is, I had a misconception about this, thinking that when the accordion opens, the screen reader should read the text, but then I realized that the arrow key should be used. The links you shared are really great, thank you very much.