ally.js is a dependency-free (well, some shims, yes) Library to help applications with accessibility concerns. The intention is to separate these components from actual applications. It is being developed along side another project and features get added to ally.js once they become necessary in the other application - or someone sends a PR. The ultimate goal is to make adhering to WAI-ARIA a breeze.
Do not confuse ally.js with a11y.js, a library to help with ARIA states.
- simplify managing focus
- simplify WAI-ARIA keyboard interactions for defined ARIA roles
- simplify working with aria attributes (only if a11y.js doesn't cover all of this already)
- allow toggling states
- simplify referencing things like
aria-describedby="…unique-id-required…"
- simplify providing "help layer" explaining available keyboard commands
dom/query-focusable,dom/is-focusable- to obtain a list of focusable elements within a given DOM elementdom/query-tabbable,dom/is-tabbable- to obtain a list of tabbable elements within a given DOM elementdom/query-tabsequence- to obtain the exact order of tabbable elements within a given DOM elementdom/active-elements- to obtain the list of ShadowDOM host elements containing the actually focused element
focus/trap-- to trap the focus within a given DOM element upon Tab (ARIA Practices: Trapping Focus)focus/first-- to identify the element that should receive focus upon entering a new contextfocus/within-- to "polyfill":focus-within
fix-browser/pointer-focus-parent-- to work around a bug in WebKit where a parent[tabindex="-1"]element can get focus when clicking on a nested<a>fix-browser/pointer-focus-input-- to work around a behavior in Safari and Firefox on Mac OS X where clicking on certain form elements would not give them focus
event/active-element-- to dispatchactive-elementevent tohtmlelement regardless offocusevent
- ES5-shim (implicitly expected)
- ES6-shim Array.prototype.findIndex (or complete ES6-shim)
- CSSOM CSS.escape polyfill
require.config({
paths: {
'ally': 'bower_components/ally.js/src',
// shims required by ally.js
'array.prototype.findindex': 'bower_components/array.prototype.findindex/index',
'CSS.escape': 'bower_components/CSS.escape/css.escape',
},
// alias array.prototype.findindex to es6-shim
// only if you're using es6-shim instead of selected bundles
// see http://requirejs.org/docs/api.html#config-map
map: {
'*': {
'array.prototype.findindex': 'es6-shim',
}
},
});- adding
fix-browser/pointer-focus-children - adding
dom/focus-targetto find the first focusable element in an element's ancestry - improving
fix-browser/pointer-focus-parentfor less complexity - improving
fix-browserby only engaging handlers for affected browsers (yes, user agent sniffing, deal with it) - fixing
dom/is-visibleto look at computed styles, not the element's styles (duh!)
- adding
fix-browser/pointer-focus-input - adding
dom/active-elementsto identify the actually focsued element and its host elements in ShadowDOM - adding
focus/withinto "polyfill":focus-within - adding warning to browser support detection when document does not have focus
- adding
supports/supports-cacheto store browser compatibility data - adding
focus/firstto identify and focus the first[autofocus]or non positive tabindex ([tabindex=1]) element - adding
dom/query-domsequenceto separate sorting and mutating the list fromdom/query-tabbable - improving
fix-browser/pointer-focus-parentfor fewer DOM interactions and less code - improving
focus/trapto allow nothing being focus and re-acquire focus when required - improving
selector/focusable(thusdom/query-focusable) by also finding focusable shadowed elements (via>>>or/deep/, ShadowDOM) - #11 - fixing
event/active-elementto be dispatched ondocumentrather thandocument.body - fixing
prototype/svgelement.prototoype.focusto also coverSVGElement.prototype.blur - fixing linting errors
- initial release "focus"
ally.js is published under the MIT License.