focusable
Updated on August 22, 2024Source codeTests
createFocusable
is a pipe that transforms an element to its first or last focusable descendant, via a depth-first search. It optionally can return the element itself, if it is focusable.
Create focusable
Call createFocusable
with no parameters to create your focusable
function.
Call createFocusable
with these parameters to create your focusable
function:
order
'first'
or 'last'
The order of the focusable element to return.
In other words, call createFocusable('first')
to create a focusable
function that will identify the first focusable descendant of an element.
options
focusable
function. See the Options section for more guidance.Options
predicatesElement
false
Indicates whether or not your focusable
function should check if the element you pass to the function is focusable.
For example, if predicatesElement
is true
, and you call focusable(someFocusableButton)
, the function would return someFocusableButton
.
tabbableSelector
focusable
uses to find focusable elements.