Nested accordions are now possible
By default, the script now supports nested accordions. To do this, the script is going to search for direct children of js-accordion
(js-accordion__header
). Before, the script was searching for all children of js-accordion
without any difference between all of them.
However, it is possible to activate a less strict mode if your site requires some div
between js-accordion
and js-accordion__header
.
This can be achieved using data-accordion-cool-selectors="1"
attribute to put onto js-accordion
. The first demo illustrates this feature.
This update has been published on Github/NPM today (See Github repositery of Van11y accordion script). Documentation has also been updated.
In addition to this, a new demo using CSS transforms has been added (and a nested accordion demo too), and a fix for WebPack users has also been added.
A big thank to @intelligence for the suggestion!