All Projects → nico3333fr → Van11y Accessible Tab Panel Aria

nico3333fr / Van11y Accessible Tab Panel Aria

Licence: mit
ES2015 accessible tabs panel system, using ARIA

Programming Languages

javascript
184084 projects - #8 most used programming language
es2015
71 projects

Projects that are alternatives of or similar to Van11y Accessible Tab Panel Aria

Accessible components
Listing of accessible components & patterns
Stars: ✭ 393 (+577.59%)
Mutual labels:  accessibility, a11y, aria
aria-collapsible
A lightweight, dependency-free JavaScript module for generating progressively-enhanced collapsible regions using ARIA States and Properties.
Stars: ✭ 25 (-56.9%)
Mutual labels:  accessibility, a11y, aria
jquery-accessible-simple-tooltip-aria
jQuery accessible simple tooltip window, using ARIA
Stars: ✭ 22 (-62.07%)
Mutual labels:  accessibility, a11y, aria
A11y tooltips
Accessible Tooltip Component
Stars: ✭ 35 (-39.66%)
Mutual labels:  accessibility, a11y, aria
jquery-accessible-modal-window-aria
jQuery simple and accessible modal window, using ARIA
Stars: ✭ 61 (+5.17%)
Mutual labels:  accessibility, a11y, aria
Eslint Plugin Jsx A11y
Static AST checker for a11y rules on JSX elements.
Stars: ✭ 2,609 (+4398.28%)
Mutual labels:  accessibility, a11y, aria
van11y-accessible-simple-tooltip-aria
ES2015 accessible simple tooltip, using ARIA
Stars: ✭ 22 (-62.07%)
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 (+60.34%)
Mutual labels:  accessibility, a11y, aria
alfa
♿ Suite of open and standards-based tools for performing reliable accessibility conformance testing at scale
Stars: ✭ 75 (+29.31%)
Mutual labels:  accessibility, a11y, aria
jquery-accessible-carrousel-aria
jQuery Accessible Carrousel System, using ARIA
Stars: ✭ 40 (-31.03%)
Mutual labels:  accessibility, a11y, aria
Accessible modal window
Accessible modal dialogs
Stars: ✭ 196 (+237.93%)
Mutual labels:  accessibility, a11y, aria
van11y-accessible-hide-show-aria
ES2015 accessible hide-show system (collapsible regions), using ARIA
Stars: ✭ 34 (-41.38%)
Mutual labels:  accessibility, a11y, aria
Skin
Pure CSS framework designed & developed by eBay for a branded, e-commerce marketplace.
Stars: ✭ 126 (+117.24%)
Mutual labels:  accessibility, a11y, aria
Creatability Components
Web components for making creative tools more accessible.
Stars: ✭ 248 (+327.59%)
Mutual labels:  accessibility, a11y, aria
Accordion
Accordion module created in pure javascript & CSS. Very useful to create FAQ lists on your website.
Stars: ✭ 94 (+62.07%)
Mutual labels:  accessibility, a11y, aria
aria-at
Assistive Technology ARIA Experience Assessment
Stars: ✭ 115 (+98.28%)
Mutual labels:  accessibility, a11y, aria
a11y-accordion-tabs
A script for an accessible accordion tabs component
Stars: ✭ 50 (-13.79%)
Mutual labels:  accessibility, a11y, aria
enabler
✋ Accessibility analyzer for your frontend.
Stars: ✭ 19 (-67.24%)
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 (+368.97%)
Mutual labels:  accessibility, a11y, aria
A11y styled form controls
Various styled accessible form controls
Stars: ✭ 335 (+477.59%)
Mutual labels:  accessibility, a11y

Van11y accessible tabs panel system, using ARIA

Van11y

This script will transform a simple list of anchors to contents into a fantastic-shiny accessible tabpanel system, using ARIA.

The demo is here: https://van11y.net/downloads/tab-panel/demo/index.html

Website is here: https://van11y.net/accessible-tab-panel/

La page existe aussi en français : https://van11y.net/fr/onglets-accessibles/

How it works

ARIA is coming

The script adds all needed attributes to your tabs controls and panels (role="tab/tablist/etc.",aria-selected/controls="…").

Then a bit of styling classes

Then it will generate some classes for you, to allow styling your tabs as you want.

And JavaScript does the rest

Some listeners for keyboard and mouse interactions are added, when you activate one, it will updates attributes and manage keyboard interations.

How to use it

Download the script

You may also use npm command: npm i van11y-accessible-tab-panel-aria.

You may also use bower: bower install van11y-accessible-tab-panel-aria.

Conventions

Then, follow the conventions given in this minimal example (in bold).

  • use classes needed (js-tabs, js-tablist, js-tablist__item, js-tablist__link, js-tabcontent)
  • check that your anchors are working.
  • for accessibility purposes (for VoiceOver), the plugin has to give focus to hx (h2, h3, h4, etc.) in tab contents.

For Hx, you have two cases:

  • There aren’t any in your js-tabcontent’s, so specify in data-hx attribute (will be added with class="invisible", which means visually hidden);
  • There are some, just tell it to the plugin using data-existing-hx attribute.

Example without hx:

<div class="js-tabs">
  <ul class="js-tablist" data-hx="h2">
   <li class="js-tablist__item">
    <a  class="js-tablist__link">1st tab</a>
   </li>
   <li class="js-tablist__item">
    <a  class="js-tablist__link">2nd tab</a>
   </li>
  </ul>
 <div id="id_first" class="js-tabcontent">
   here the content of 1st tab
 </div>
 <div id="id_second" class="js-tabcontent">
   here the content of 2nd tab
 </div>
</div>

Example with hx:

<div class="js-tabs">
  <ul class="js-tablist" data-existing-hx="h2">
   <li class="js-tablist__item">
    <a  class="js-tablist__link">1st tab</a>
   </li>
   <li class="js-tablist__item">
    <a  class="js-tablist__link">2nd tab</a>
   </li>
  </ul>
 <div id="id_first" class="js-tabcontent">
   <h2>title</h2>
   here the content of 1st tab
 </div>
 <div id="id_second" class="js-tabcontent">
   <h2>other title</h2>
   here the content of 2nd tab
 </div>
</div>

The script is launched when the page is loaded. If you need to execute it on AJAX-inserted content, you may use for example on <div id="newContent">your tab panel source</div>:

van11yAccessibleTabPanelAria(document.getElementById('newContent'));

Keyboard shortcuts

If you focus on the tabs “buttons”:

  • use Up/Left to see previous tab,
  • use Down/Right to see next tab
  • use Home to see first tab (wherever you are in tab buttons)
  • use End to see last tab (wherever you are in tab buttons)

If you focus on a tab content:

  • use Ctrl Up/Left to set focus on the tab button for the currently displayed tab
  • use Ctrl PageUp to set focus on the previous tab button for the currently displayed tab
  • use Ctrl PageDown to set focus on the next tab button for the currently displayed tab

Warning: Ctrl+PageUp/PageDown combination could activate for some browsers a switch of browser tabs. Nothing to do for this, as far as I know (if you have a solution, let me know).

Logic of styling classes

Before Javascript

Once you set up the code with your content, style it before activating JavaScript: so it will be nice even if there is no JavaScript.

For example, just imagine you are on poor mobile connexion, and the JavaScript hasn’t (yet) loaded. Or it can be disabled.

After Javascript

You should add classes to the source, and use them this way:

[role="tablist"].my-style {…}

Basically, you should rely on ARIA attributes, so styles will be applied only if JavaScript is loaded and well-executed. Namespaced generated classes

The plugin has another feature: if you don’t like styling on role attributes, it can generate classes for you only for styling tabs when they are activated.

Here is an example:

<ul … data-tabs-prefix-class="last-tabs">

The data-tabs-prefix-class will add classes on each elements:

<ul … class="… last-tabs-tabs__list">
  <li … class="… last-tabs-tabs__item">
    <a … class="… last-tabs-tabs__link">…

So with data-tabs-prefix-class="last-tabs" you have:

  • last-tabs-tabs__list for styling the ul;
  • last-tabs-tabs__item for styling the li;
  • last-tabs-tabs__link for styling the a;
  • last-tabs-tabs__content for styling each tab panel.

Bonuses

Tab panel opened by default

If you need a tab to be opened by default, it is possible, using data-selected="1" on the .js-tablist__link you need to be opened (See the demo, second example).

Other tabs are still available, here are the rules for this feature:

  • The fragment detection (explained below) will always have priority on this feature;
  • If there are several data-selected="1" put on tabs in the same group (which does not make sense and should never happen), the first one will be used.

Anchor added in URL

As you may notice (or not), now the script adds a fragment in the URL when you click or select a tab using the keyboard. It is cool when you want to copy/paste the link of the page you are reading, and the opened tab will be the good one! Anchor on a tab panel

If you need to make a link on your page to a id that is on a tab panel, the script will detect it and display the good tab, only for you.

If you want to test, open a new window, and copy/paste this: https://van11y.net/downloads/tab-panel/demo/index.html#id_third

Anchor in a tab panel

If you need to make a link on your page to a id that is in a tab panel, the script will detect it and display the good tab, only for you.

If you want to test, open a new window, and copy/paste this: https://van11y.net/downloads/tab-panel/demo/index.html#cool-anchor

“In-page” link to a tab panel

If you need to create in your current page a link to a tab (inside or outside), it is possible:

  • Create the link to the content you want to target: <a >link to tab option</a>
  • Add the class class="js-link-to-tab" to it;
  • And that’s all. The plugin will make it work.
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].