4 ms·
Ideally they would use a styled <details> element, which provides exactly the desired behavior without needing JavaScript. Edit: At least, exactly the desired
by comex 5y ago
Ideally they would use a styled <details> element, which provides exactly the desired behavior without needing JavaScript.
Edit: At least, exactly the desired behavior for accordions within the page, where, once you expand a section, you expect it to close again only if you click the section header a second time. It would be less suited for a dropdown menu, which needs to be dismissed if the user clicks anywhere else on the page - though there might be some way to make it work.