Expander 1.1 - External triggers

Back to changelog

This update refactors Expander and adds the capability for triggers to toggle expandable sections that are not their ancestors, by using the aria-controls attribute.

As part of this refactor, the JavaScript that added tabindex="0" to each trigger has been removed. This was in place so that triggers may not be focusable if there is no JavaScript on the page, but I decided it was better to keep the triggers focusable in that case as well instead of encourage leaving it off elements when writing HTML.

Breaking changes

  • Triggers no longer have a tabindex attribute added via JavaScript. If they are not using a natively focusable element, they should have tabindex="0".

Non-breaking changes

  • Triggers can sit outside the expandable section they control, if they have an aria-controls attribute matching the expandable section's id attribute.