This is a library to automatically inject the standard for screen readers mark-up ARIA. ARIA is Accessible Rich Internet Applications which is a way to make websites and applications more accessible to people with disabilities.
This libraries purpose is to automatically inject the necessary tags and commands to the users mark-up, so that it meets the standards as much as possible. There are also commands for the users to inject the methods on to specific parts if the library does not get them automatically. Also the automatic functionality can be turned off if only partly needed.
Here are some helpful links about ARIA to help understand the tags and their values.
- Open Ajax – http://oaa-accessibility.org/
- W3C – http://w3c.github.io/html-reference/aria/aria.html
- Mozilla Developer Network – https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA
ARIA Control Library V1 Method Breakdown
Hidden (has auto)
This detects all the elements that are ‘display:none’ and/or ‘visibility:hidden’. It will then add the ARIA ‘aria-hidden’ and give it a role of ‘presentation’. This makes the element hidden from screen readers. There is also a method to make the element un hidden if the state changes.
Hidden Message (has auto)
This method uses the given class in the options to make the element display off the page. This means that the screen reader can see the message and read it out, but sighted users won’t be able to see the message. This is useful if you want to give extra information only to the users using a screen reader.
This sets the attributes for ‘aria-atomic’, ‘role’ and ‘aria-live’. These are the attributes best served as a notification.
Alert (has auto)
This is for error messages and other alerts to the user. This will use the notification method above with the settings as ‘aria-atomic: true’, ‘role: alert’ and ‘aria-live: rude’. This can be automatically run with a set class.
Warning (has auto)
This is for warning messages and other none critical alerts to the user. This will use the notification method above with the settings as ‘aria-atomic: true’, ‘role: alert’ and ‘aria-live: assertive’. This can be automatically run with a set class.
Message (has auto)
This is for any message that is not critical like a success message. This will use the notification method above with the settings as ‘aria-atomic: true’, ‘role: alert’ and ‘aria-live: polite’. This can be automatically run with a set class.
Required (has auto)
Any element, usually inputs, that has the attribute ‘required’ on them will have the ARIA tag ‘aria-required’ added to the element. This can also be done manually by passing the class.
Popup (has auto)
With this method you need to set up the popup classes for the control and the popup. It is mainly aimed at the tooltip example, e.g. if you click in a field and then a tooltip shows. The method will give the control the aria tags to show it has a popup and the tooltip the tags to show what controls it. You can also pass the role type, but by default it is ‘tooltip’.
Show and Hide Popup
These are more helper methods to the above. When the popup shows or hides you can call these method to update the elements settings.
Checked Elements (has auto)
Both Checkboxes and Radio buttons will automatically have the check item injected with the ARIA ‘aria-checked’. This marks if the element is checked or not, for which the change event is also added to all of the elements so if it becomes checked or unchecked then it is updated.
Disabled (has auto)
Any disabled element will have the ‘aria-disabled’ tag added to it.
Selected Option (has auto)
This will make all the options in a select element ‘aria-selected: false’ then find the selected option to set it to true. It also adds the event change to detect when the selected has changed and updates them.
Max and Min (has auto)
This will mainly be for inputs with a max or min value. It finds if they have a value then puts them in their relative tags, either ‘aria-valuemin’ or ‘aria-valuemax’.
Navigation (only has auto)
A complex one, but easy to set up. With all the correct settings this can add the tags to show up to screen readers as a navigation. It will also tag the links as menu items and the sub menu as well as being a popup. It uses the hover event to detect when the sub menu is being shown.
Button (has auto)
This will detect the all button types and add its role as ‘button’
ARIA Control Library V1 Options Breakdown
autoDetect (default = true)
This determines if to automatically tag the elements or to only allow manual running.
alertClass (default = .acAlert)
Used for the auto detection for Alert Notifications.
warningClass (default = .acWarning)
Used for the auto detection for Warning Notifications.
msgClass (default = .acMsg)
Used for the auto detection for Message Notifications.
popupClass (default = .acTooltip)
The class of the popup or, as the example was, the tooltip.
popupCtrlClass (default = .acTooltipCtrl)
The element that triggers the popup or tooltip to show.
popupType (default = tooltip)
The role of the popup.
hiddenMsgClass (default = .acHiddenMsg)
The class of any hidden messages that don’t show to slighted users.
navClass (default = .acNav)
The navigation containers class.
navParentClass (default = .acSubNav)
The top level links class.
navSubNavClass (default = .acSubMenu)
The sub menu class.