Skip to content

ally.js

JavaScript library to help modern web applications with accessibility concerns by making accessibility simpler

🔗ally.query.tabbable

Finds keyboard focusable ("tabbable") elements in the DOM.

🔗Description

See ally.query.focusable for an explanation on the different query strategies.

Consult the data tables what browsers consider focusable and what ally.js considers focusable in strategy: "strict" or strategy: "quick" to learn how HTML elements behave.

🔗Usage

var elements = ally.query.tabbable({
  context: '.within-filter-selector',
  includeContext: true,
  strategy: 'quick',
});

🔗Arguments

NameTypeDefaultDescription
context<selector>documentElementThe scope of the DOM in which to search. The first element of a collection is used.
includeContextbooleanfalsePrepend the context element if it is focusable.
includeOnlyTabbablebooleanfalseInclude elements that would otherwise be ignored because they're considered only tabbable,
strategy"quick", "strict", "all""quick"The approach used to find elements.

🔗Returns

Array of HTMLElement.

🔗Examples

🔗Example: ally.query.focusable Example

ally.query.focusable Example on jsbin.com

play with the example on jsbin.com or open the source document

🔗Example: ally.query.tabbable Example

ally.query.tabbable Example on jsbin.com

play with the example on jsbin.com or open the source document

🔗Changes

🔗Notes

See ally.is.focusRelevant

🔗Related resources

🔗Contributing