🔗ally.is.tabbable
Determines if an element is considered keyboard focusable ("tabbable").
🔗Description
The function does not verify if an element is focusable. It expects input that is considered focusable, so isTabbable(element)
does not always equal isFocusable(element) && isTabbable(element)
.
Consult the data tables what browsers consider focusable and what ally.js considers focusable to learn how HTML elements behave.
🔗Usage
var element = document.getElementById('victim');
var isTabbable = ally.is.tabbable(element);
🔗Arguments
Name | Type | Default | Description |
---|---|---|---|
element | HTMLElement | required | The Element to test. |
🔗Returns
Boolean, true
if the element is focus relevant.
🔗Throws
TypeError
if element
argument is not of type HTMLElement
.
🔗Changes
- Since
v#master
matching ofSVGElement
s is done document-independent, to allow elements from other documents (e.g. from an iframe). - Since
v#master
all<iframe>
elements are considered focusable, not tabbable - except for IE9.
🔗Notes
Element.tabIndex
property gives some indication, but ultimately user agent sniffing (via platform.js) is done internally to fix mismatches.🔗Related resources
ally.is.focusRelevant
identifies elements that can receive focusally.is.focusable
identifies elements that are focusableally.is.onlyTabbable
identifies elements that are keyboard focusable but not focusable by scriptally.query.tabbable
finds keyboard focusable elements in the DOM