🔗ally.is.focusable
Determines if an element is considered focusable.
🔗Description
An element is considered focusable if it is ally.is.focusRelevant
, ally.is.visible
and not ally.is.disabled
.
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 isFocusable = ally.is.focusable(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
all<area>
elements are considered focus-relevant, but only valid<area>
elements are considered focusable.
🔗Notes
🔗Related resources
ally.is.focusRelevant
is used to identify elements that can receive focusally.is.focusable
identifies elements that are focusableally.query.focusable
finds focusable elements in the DOMally.is.validArea
is used to identify if<area>
elements satisfy the requirements to be considered focusable