DEV Community

Discussion on: How to build an Accordion Menu using HTML, CSS and JavaScript

Collapse
 
auroratide profile image
Timothy Foster

Very well-made tutorial! Love the imagery and how you annotate/explain the code blocks.

I definitely recommend looking into the details HTML element. Besides no longer needing Javascript, it also makes the accordion more accessible, allowing assistive tools like screen readers to announce when something can be collapsed or expanded.

Using just divs, you would have to manually add aria roles, labels, and possibly controls to achieve the same thing.

Collapse
 
ubahthebuilder profile image
Kingsley Ubah

Hi Timothy,

Thanks a lot.