ally.query.tabbable
September 28, 2016 ยท View on GitHub
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
| Name | Type | Default | Description |
|---|---|---|---|
| context | <selector> | documentElement | The scope of the DOM in which to search. The first element of a collection is used. |
| includeContext | boolean | false | Prepend the context element if it is focusable. |
| includeOnlyTabbable | boolean | false | Include 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.
Throws
Examples
@@@example /api/query/focusable.example.html
focusable example
@@@
@@@example /api/query/tabbable.example.html
tabbable example
@@@
Changes
- Since
v1.1.0the optionincludeOnlyTabbableallows to skip the internal filter preventing this module from returning elements that cannot be focused by script.
Notes
Related resources
ally.is.tabbableis used to filter focusable elementsally.query.focusableis used to find focusable elementsally.query.firstTabbablefinds the first keyboard focusable element in a contextally.query.tabsequencefinds keyboard focusable elements in Sequential Navigation Focus Order