Simple Accessible Accordion Plugin For jQuery - A11y-Accordion

Simple Accessible Accordion Plugin For jQuery - A11y-Accordion
File Size: 8.26 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

A11y-Accordion is a JQuery plugin that adds keyboard navigation and WAI-ARIA roles to your accordion to make it more accessible for keyboard and screen reader users. 

How to use it:

1. Download and load the jQuery A11y-accordion plugin after loading jQuery library.

<script src="//"></script>
<script src="assets/a11y-accordion.js"></script>

2. Add the tabs and panels to the accordion using the following data attributes:

  • data-showall="true": show all panels
  • data-multi-open="true": allows to open multiple panels
  • data-showbydefault="true": show individual panel by default
  • data-tab-label="Your Label Here": custom text label for tab
<div class="accordion" data-action="is-accordion" data-multi-open="true" data-showall="false" id="accGen">
  <div class="js-acc__panel accordion__panel" data-tab-label="Accordion 1">
      Accordion 1
  <div class="js-acc__panel accordion__panel" data-showbydefault="true">
    <h3>Accordion 2</h3>
      Accordion 2

3. Apply your custom CSS styles to the accordion.

.accordion__trigger, button.accordion__trigger {
  background-color: #f8f8f8;
  border: 0;
  border-bottom: 1px solid #444;
  font-size: inherit;
  color: #4464c2;
  cursor: pointer;
  display: block;
  padding: 0.5em 1em;
  text-decoration: none;
  text-transform: none;
  outline: none;
} {
  background-color: #304c9d;
  color: #fff;

.accordion__trigger:hover, .accordion__trigger:focus {
  background-color: #6589f2;
  color: #fff;
  outline: none;

.accordion__panel {
  background-color: inherit;
  display: none;
  padding: 20px;

.no-js .accordion__trigger { color: inherit; }

.no-js .accordion__panel { display: block; }

button.accordion__trigger {
  -webkit-appearance: none;
  box-shadow: none;
  border-radius: 0;
  text-align: left;
  width: 100%;

Change log:


This awesome jQuery plugin is developed by scottaohara. For more Advanced Usages, please check the demo page or visit the official website.