PayPal provides an excellent library that extends a few of Bootstrap's default complex components to enhance use with Assistive Technologies. Using a correct structure alleviates the need to provide custom event handling and keyboard navigation. The caveat is the structure must be closely followed. The PayPal assistive library enhances the following components:
Nearly every custom component we use can be abstracted into one of these objects, and as such it would be prudent to abstract these components into views/templates that are easily implemented without the need of a developer to concern him or herself with maintaining the proper structure and roles. That said, PayPal recommends avoiding the carousel object, as it does not adequately meet WCAG 2.0 standards.
This page is meant to serve as an example of implementations and possible uses for each enhanced component, as well as what custom work is needed when all of the events are not handled by default. Enhanced components do not necessarily follow standard Bootstrap patterns, so it would be wise to not follow Bootstrap class patterns when attempting to ensure accessibility.
Not all Assistive Technologies work the same and some default keyboard navigation functionality may be overridden. Also note that some glitches may occur with non linear navigation, such as dropdowns, where Bootstrap handles focus. In these cases the screen reader may attempt to read the following tab-able element before reading the dropdown. This generally can't be avoided, and is a race condition. Another glitch that may occur is that certain items may be read twice.
All group-able objects need proper roles assigned. Bootstrap's API can be referenced for this, but things such as grouped buttons, lists, and navigation elements have specific aria roles which need to be applied to the parent container and each element within. The source HTML on this page can be used as a starting reference.
Any route control must have an element with the same id within the page. For instance, ehmp-ui/#overview needs and element with id="overview" in order for Assistive Technologies to be notified of content changes. Any anchor with href="#some_id" needs a corresponding element with the appropriate id.
The ALT attribute should never be used. To notify the screen reader of any alternate data attributes, use a span or div with class="sr-only", or add a title attribute directly to an actionable element.
Using custom focus modifiers or custom key event handling is generally not only unwarranted, but will cause undesired behavior. Before designing a template, start with determining which one of these enhanced components best fits the needs of the design. For instance, any floating dialogs should be abstracted to a modal. Dynamic content attached directly to a DOM element should use a dropdown. In the case where an example uses a button or anchor in some, but not all cases, other elements that are by default non-functional can be substituted so long as tabindex="0" and role="button" are added (and are imperative in order to meet compliance). See the media dropdown below. Note that element substitution may require custom event handling and as such is not recommended. Manually setting focus can lead to keyboard navigation traps.
Contents of Tab #1
Contents of Tab #2
Contents of Tab #3
This is meant to demonstrate that the placemenet is not important. However, it should be noted that this format is discouraged since the DOM order is illogical for keyboard navigation. In general, actionable elements should be in the DOM before dynamic content.
Search for something
Display something
Focus Management :
When the alert is dismissed with keyboard make sure the focus is transferred back to the element which fired this alert. This is not handled by default and requires custom event handling. See the source code for this page.
Note that this element is not dyanmically generated in this example so when dismiss is triggered the element is automatically destroyed. In typical use we would generated this element and inject it into a region which would avoid the first concern and allow us to reopen this alert once closed since the DOM elements would be generated again.
These components are not keyboard navigable. Instead, the title attribute and spans using class="sr-only" are used to inform Assistive Technologies. The span approach is redundant since title or data-original-title must be supplied but not all Assistive Technologies work the same.
Here is an example of a tooltipUsing an anchor tag...
...and here one with a button
...and using a span |hover meI'm a span tooltip|
Dismissible popoverThis is the content that will be displayed in the popover
There will be times when no Bootstrap object satisfies the needs of the design. In these cases, it will be entirely up to the developer to implement an adequate solution. The following is one of these cases. There is a grid that when an item within the grid is clicked information in a box to the right will be updated dynamically. To satisfy 508, when this click happen, focus needs to shift to the box that was updated. Shift+tab needs to return focus to the row that triggered the change. Arrow key navigation will be used in the grid itself.