Native HTML Accordions Offer Lightweight, Accessible UI Without JavaScript
Developers often overlook the power of native browser capabilities when seeking solutions for interactive components, favoring heavy libraries instead. In a recent blog post, Mario Hernandez demonstrates how HTML's <details> and <summary> elements can be used to build lightweight, accessible accordion interfaces—no JavaScript required.
With browser support for <details> reaching Baseline Widely Available status in 2020, Hernandez argues it's time developers reconsider these semantic tools. The native disclosure widget behaves predictably, is fully keyboard-accessible, and responds to screen readers—making it accessible by default. He shares both simple and advanced markup patterns, showing how developers can retain flexibility while maintaining standards compliance.
One standout feature is the name attribute, which enables exclusive accordion behavior across grouped elements—something traditionally done with JavaScript. Hernandez also points out lesser-known capabilities, such as automatic expansion of matching text during in-page search, and how the open attribute enables easy state-based styling. This native-first approach dramatically reduces dependency overhead while enhancing performance and maintainability.
The post ends with a call to action for seasoned developers: revisit foundational web features. According to Hernandez, modern HTML and CSS now do far more than many assume, and often with greater efficiency than custom code or third-party tools.


