# API index
When creating web applications or UI widgets these modules may come in handy.
# Countering browser bugs
Every software has its problems - so do browsers. These utilities combat things browsers get wrong.
ally.fix.pointerFocusChildren(Internet Explorer 10 - 11)
ally.fix.pointerFocusInput(Safari and Firefox on Mac OS X)
ally.fix.pointerFocusParent(WebKit and old Blink)
:focus is not enough for communicating your application's intentions properly.
# Altering browser focus behavior
While it's best to use standardized features and leave browsers to figure things out, specifications sometimes leave us hanging in limbo.
ally.maintain.disabledrenders elements inert to prevent any user interaction
aria-hidden="true"on insignificant branches
ally.maintain.tabFocustraps TAB focus in the tabsequence
# Finding elements
In order to work with focusable elements, we must first know which elements we're supposed to work with. See what does "focusable" mean? for a differentiation.
ally.query.firstTabbablefinds the first keyboard focusable element
ally.query.focusablefinds all focusable elements
ally.query.shadowHostsfinds all elements hosting a
ally.query.tabbablefinds all keyboard focusable elements in DOM order
ally.query.tabsequencefinds all keyboard focusable elements in Sequential Navigation Focus Order
# Element state
Unlike any other ally modules, these components do not take take
options.context argument, but expect the
element as first argument, allowing easy use in
.filter(). See what does "focusable" mean? for a differentiation.
ally.is.activeElementreturns true if the element is the activeElement of its host context, i.e. its document, iFrame or ShadowHost
ally.is.disabledreturns true if the element is
ally.is.focusRelevantreturns true if the element is considered theoretically focusable
ally.is.focusablereturns true if the element is considered focusable by script
ally.is.onlyTabbablereturns true if the element is tabbable but not focusable
ally.is.shadowedreturns true if the element is the descendant of a
ally.is.tabbablereturns true if the element is considered keyboard focusable ("tabbable")
ally.is.validAreareturns true if the
<area>element is properly used via
ally.is.validTabindexreturns true if the element's
tabindexattribute value is sound
ally.is.visiblereturns true if the element is rendered (but not necessarily visible in the viewport)
# Manipulating element state
Making up for missing or lacking DOM mutation APIs.
ally.element.blurshifts focus away from an element
ally.element.disableddisables all elements, not only form controls
ally.element.focusshifts focus to an element
# Reacting to element state
Especially when dealing with transitional user interfaces we need to know when an element can be safely focused.
ally.when.focusableexecutes a callback once an element fulfills
ally.is.focusableand is visible in the viewport
ally.when.keyexecutes a callback when a given key has been pressed
ally.when.visibleAreaexecutes a callback once an element is visible in the viewport
# DOM traversal
Sometimes you need some DOM traversal utilities
ally.get.insignificantBranchesreturns an array containing the branches of the DOM that do contain any of the target elements
ally.get.activeElementidentifies the element that has focus
ally.map.attributemaps WAI-ARIA states and properties
ally.map.keycodemaps control keys to readable names
# Developer modules
When creating libraries these modules may come in handy.
When you find yourself using one of these in your application code, we should talk about what you're trying to achieve and how we could do that as part of the library instead. Get in touch, file an issue explaining what you're trying to achieve!
# DOM traversal (extended)
Sometimes you need some DOM traversal utilities
ShadowHostancestry of the active element
# Event dispatchers
Emitting events when there's no standardized equivalent
# Event listeners
Translate volatile events to stateful interfaces
ally.observe.interactionTypeobserves user interaction method to distinguish pointer and keyboard actions
MutationObservers across nested
# Contributor modules
When working on ally.js these modules may come in handy.
When you find yourself using one of these in your application or library code, we should talk about what you're trying to achieve and how we could do that as part of the library instead. Get in touch, file an issue explaining what you're trying to achieve!
These modules are only available to be consumed via ES6, AMD or CommonJS directly, they are not exposed in the production bundle
The internal tools are documented in a less accessible way to make it just a tiny bit harder for someone not working on ally to use them. This is intentional. The stability of these APIs is not guaranteed.