SHIFT + D

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:

Parameter
Type
Required
Description
order
'first' or 'last'
yes

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
Object
no
Options to customize the behavior of the focusable function. See the Options section for more guidance.

Options

Option
Type
Default
Description
predicatesElement
Boolean
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
String
See source code
Customizes the CSS selector that focusable uses to find focusable elements.

find index asyncgreater or equal

Edit doc on GitHub

ON THIS PAGE

focusableCreate focusableOptions