Accordions - things to look out for

Question

We’re looking to implement accordion functionality on our website. What do we need to look out for?

Answer

The things to watch out for are that:

  • it can be operated with a keyboard — so people can tab onto it and then press enter to open and close it, and

  • the titles behave like links — so that if people don’t know what an accordion is they can still click it as if it’s a link

  • our accordion titles are actually headings for the content underneath them, even though they look like links.

We also used details/summary elements as this was more semantically correct.

http://www.w3schools.com/tags/tag_summary.asp

Last updated