Accessible jQuery Plugin For Accordion | wfAccordion

wfAccordion is a plugin for jQuery to enhance the predefined flags with the accordion accessible function that supports the keyboard.

The jQuery wfAccordion plugin makes it easy to help developers create responsive and accessible accordions of split content or FAQs.

How it works:

  • Enhance triggers and panels with ARIA themes: expand aria, hide aria, disable aria.
  • Create unique identifiers for use in ARIA relationships: aria and aria-labeled controls.
  • Create ARIA relationships between headers and panels.
  • ARIA statuses update on click.
  • Refine a specific placeholder with <button> for better keyboard support.

Keyboard support:

  • Open / close the accordion panels using the up / down arrows plus Ctrl + Page Up / Page Down keys.
  • Focus on the first accordion with the end key.
  • Focus on the last accordion with the Home key.

How to make use of it:

1. To get started, include the wf.accordion.js script after jQuery.

<script src="/path/to/jquery.min.js"></script>
<script src="/path/to/wf.accordion.js"></script>

2. Build the HTML structure for the accordion.

<div class="wf-accordion-group js-accordion-group">

  <div class="wf-accordion js-accordion">
    <div class="wf-accordion__header js-accordion__header">
      <h3 class="wf-accordion__trigger js-accordion__trigger">Accordion 1</h3>
    <div class="wf-accordion__panel js-accordion__panel">
      Accordion Panel 1

  <div class="wf-accordion js-accordion">
    <div class="wf-accordion__header js-accordion__header">
      <h3 class="wf-accordion__trigger js-accordion__trigger">Accordion 2</h3>
    <div class="wf-accordion__panel js-accordion__panel">
      Accordion Panel 2

  <div class="wf-accordion js-accordion">
    <div class="wf-accordion__header js-accordion__header">
      <h3 class="wf-accordion__trigger js-accordion__trigger">Accordion 3</h3>
    <div class="wf-accordion__panel js-accordion__panel">
      Accordion Panel 3



3. Call the plugin on the upper container.


4. Apply your own CSS styles to the accordion.

* Accordion example styles

.wf-accordion-group {
  margin-top: 15px;

/* All elements succeeding an accordion group use margin-top to create white space */
.wf-accordion-group + * {
  margin-top: 30px;

/* All accordions have borders… */
.wf-accordion {
  border-top: 1px solid #bfbfbf;
  border-bottom: 1px solid #bfbfbf;

/* …unless they directly succeed another accordion, in which case we reset the top-border
to avoid duplicate white space */
.wf-accordion + .wf-accordion {
  border-top-width: 0;

.wf-accordion__header {
  color: #616161;

/* Please note: The trigger element is a <button> create via JS. To achieve consistent aesthetics,
 the native button styles have to be resetted here */
.wf-accordion__trigger {
  /* baseline resets */
  background: transparent;
  border-width: 0;
  border-radius: 0;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-block;
  font-size: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  margin: 0;
  padding: 0;
  text-align: left;
  text-decoration: none;
  /* end of baseline resets */

  /* additional styles for the demo */
  display: block;
  padding: 10px 1.25em 10px 8px;
  position: relative;
  width: 100%;

.wf-accordion__trigger::after {
  content: '';
  border: solid #bfbfbf;
  border-width: 0 2px 2px 0;
  height: 0.5em;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-60%) rotate(45deg);
  width: 0.5em;

.wf-accordion__trigger[aria-disabled=true] {
  cursor: not-allowed;
  opacity: 0.5;

.wf-accordion__trigger[aria-expanded=true]::after {
  transform: translateY(-30%) rotate(-135deg);

.wf-accordion__trigger:focus {
  background: #f5f5f5;
  color: #161616;

.wf-accordion__trigger:focus::after {
  border-color: #161616;

.wf-accordion__panel {
  background-color: #fff;
  padding: 10px 8px;

.wf-accordion__panel[aria-hidden=true] {
  display: none;

5. Override the CSS default settings.

  accordionGroup: '.js-accordion-group',
  accordionHeader: '.js-accordion__header',
  accordionTrigger: '.js-accordion__trigger',
  accordionPanel: '.js-accordion__panel',
  accordionIsOpenClass: 'js-accordion--is-expanded'

Keyboard Accessible Accordion Plugin, wfAccordion Github, jquery accessible accordion, jquery UI accordion accessibility

See Demo And Download

Official Website(webfactory): Click Here

This superior jQuery/javascript plugin is developed by webfactory. For extra advanced usage, please go to the official website.

Related Posts


Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…


Simple jQuery Cookie Consent Plugin

jquery.cookie-consent is a simple jQuery plugin to request consent to use cookies. An easy-to-use and highly customizable cookie consent bar that informs your visitors of the use…


Timepicker JavaScript Plugin for jQuery Inspired by Google Calendar

jquery.timepicker is a lightweight jQuery timer plugin inspired by Google Calendar. It supports both mouse and keyboard navigation and weighs 5.5KB minified and compact. Features: Highly customizable…


A Lightweight, Touchable, and Responsive Angular Universal Carousel Library

ngxCarousel is a lightweight, tactile, and responsive library for creating an angular carousel. No dependencies, no more hammer. Must Read: Angular Responsive Image Slider With Lightbox Popup…


Generate a Random Number Picker In Vanilla JavaScript

Random Number Picker is a Vanilla JS-based number picker that allows you to generate a random number within a specified range. Must Read: Generating Lottery Numbers Using…


Nepali Date Picker jQuery Plugin | nepaliDatePicker

Nepali Date Picker is a customizable, easy-to-use, and input-based date picker plugin mostly based on the Nepali calendar. Users can choose a Nepali date in the navigable…