All Projects → jgarber623 → aria-collapsible

jgarber623 / aria-collapsible

Licence: MIT license
A lightweight, dependency-free JavaScript module for generating progressively-enhanced collapsible regions using ARIA States and Properties.

Programming Languages

HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to aria-collapsible

van11y-accessible-hide-show-aria
ES2015 accessible hide-show system (collapsible regions), using ARIA
Stars: ✭ 34 (+36%)
Mutual labels:  accessibility, a11y, aria
Van11y Accessible Tab Panel Aria
ES2015 accessible tabs panel system, using ARIA
Stars: ✭ 58 (+132%)
Mutual labels:  accessibility, a11y, aria
Js Offcanvas
A lightweight, flexible jQuery off-canvas navigation plugin which lets you create fully accessible sidebar or top/bottom sliding (or push) panels with keyboard interactions and ARIA attributes.
Stars: ✭ 272 (+988%)
Mutual labels:  accessibility, a11y, aria
aria-at
Assistive Technology ARIA Experience Assessment
Stars: ✭ 115 (+360%)
Mutual labels:  accessibility, a11y, aria
Accessible modal window
Accessible modal dialogs
Stars: ✭ 196 (+684%)
Mutual labels:  accessibility, a11y, aria
enabler
✋ Accessibility analyzer for your frontend.
Stars: ✭ 19 (-24%)
Mutual labels:  accessibility, a11y, aria
A11y tooltips
Accessible Tooltip Component
Stars: ✭ 35 (+40%)
Mutual labels:  accessibility, a11y, aria
a11y-accordion-tabs
A script for an accessible accordion tabs component
Stars: ✭ 50 (+100%)
Mutual labels:  accessibility, a11y, aria
Skin
Pure CSS framework designed & developed by eBay for a branded, e-commerce marketplace.
Stars: ✭ 126 (+404%)
Mutual labels:  accessibility, a11y, aria
Accordion
Accordion module created in pure javascript & CSS. Very useful to create FAQ lists on your website.
Stars: ✭ 94 (+276%)
Mutual labels:  accessibility, a11y, aria
jquery-accessible-modal-window-aria
jQuery simple and accessible modal window, using ARIA
Stars: ✭ 61 (+144%)
Mutual labels:  accessibility, a11y, aria
Creatability Components
Web components for making creative tools more accessible.
Stars: ✭ 248 (+892%)
Mutual labels:  accessibility, a11y, aria
alfa
♿ Suite of open and standards-based tools for performing reliable accessibility conformance testing at scale
Stars: ✭ 75 (+200%)
Mutual labels:  accessibility, a11y, aria
van11y-accessible-simple-tooltip-aria
ES2015 accessible simple tooltip, using ARIA
Stars: ✭ 22 (-12%)
Mutual labels:  accessibility, a11y, aria
jquery-accessible-carrousel-aria
jQuery Accessible Carrousel System, using ARIA
Stars: ✭ 40 (+60%)
Mutual labels:  accessibility, a11y, aria
Accessible components
Listing of accessible components & patterns
Stars: ✭ 393 (+1472%)
Mutual labels:  accessibility, a11y, aria
Accessible Html Content Patterns
♿️ The full HTML5 Doctor Element Index as well as common markup patterns for quick reference.
Stars: ✭ 93 (+272%)
Mutual labels:  accessibility, a11y, aria
Eslint Plugin Jsx A11y
Static AST checker for a11y rules on JSX elements.
Stars: ✭ 2,609 (+10336%)
Mutual labels:  accessibility, a11y, aria
jquery-accessible-simple-tooltip-aria
jQuery accessible simple tooltip window, using ARIA
Stars: ✭ 22 (-12%)
Mutual labels:  accessibility, a11y, aria
accessibility-for-teams
A ‘quick-start’ guide for embedding accessibility and inclusive design practices into your team’s workflow
Stars: ✭ 80 (+220%)
Mutual labels:  accessibility, a11y

aria-collapsible

A lightweight, dependency-free JavaScript module for generating progressively-enhanced collapsible regions using ARIA States and Properties.

npm Downloads Build Vulnerabilities

Key Features

  • Uses ARIA States and Properties
  • Dependency-free
  • ES2015/AMD/Node module support

Getting aria-collapsible

You've got a couple options for adding aria-collapsible to your project:

  • Download a tagged version from GitHub and do it yourself (old school).
  • Install using npm: npm install aria-collapsible --save
  • Install using Yarn: yarn add aria-collapsible

Usage

HTML

To use aria-collapsible, your markup needs two elements: a control and a region. The control, typically a <button> or an <a> element, is what your user will interact with and is the element that controls the display of the collapsible region. The region is an element elsewhere on the page whose display is handled by the control.

The two elements are associated by adding an aria-controls="region" attribute to the control. The value of the aria-controls attribute corresponds to the value of the region's id attribute.

<button type="button" aria-controls="region" aria-expanded="true" aria-hidden id="control">Menu</button>

<nav id="region">
  <ul>
    <li><a href="#">Chapter 1</a></li>
    <li><a href="#">Chapter 2</a></li>
    <li><a href="#">Chapter 3</a></li>
    <li><a href="#">Chapter 4</a></li>
    <li><a href="#">Chapter 5</a></li>
  </ul>
</nav>

CSS

Most browsers don't natively hide elements with the aria-hidden attribute so you'll need to add the following to your stylesheet:

[aria-hidden] {
  display: none !important;
}

JavaScript

Lastly, initialize aria-collapsible by creating a new Collapsible, passing in a DOM reference to the control, and calling the setup() method.

const collapsible = new Collapsible(document.querySelector('#control'));

collapsible.setup();

You can see the above in action in the included example file.

Collapsible regions can be shown and hidden programatically using the toggle() method:

collapsible.toggle();

You can also teardown a collapsible region, resetting the DOM to its initial state and removing event handlers:

collapsible.teardown();

Browser Support

aria-collapsible works in modern browsers. The library makes use of several new(ish) JavaScript features, including:

  • Arrow function expressions (MDN)
  • Classes (MDN)
  • Private class fields (MDN)

aria-collapsible, in an effort to remain as lightweight and dependency-free as possible, leaves it up to you to choose whether or not to polyfill features for older browsers.

Acknowledgments

aria-collapsible is inspired by the following works:

Special thanks to Jeremy Fields for his help testing with VoiceOver.

aria-collapsible is written and maintained by Jason Garber with the help of some great contributors.

License

aria-collapsible is freely available under The MIT License. Go forth and make the Web a more accessible place.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].