Licence
MIT
Version
1.0.0
Deps
1
Size
22 kB
Vulns
0
Weekly
0
focusable
This library was generated with Nx.
Finds keyboard-focusable elements within a specified element’s subtree.
Available on npmjs.com.
Usage
In package.json add a dependency to 'focusable':
{
"dependencies": {
"@pukanito/focusable": "1.0.0"
}
}
Use Focusable:
import Focusable from '@pukanito/focusable'
const focus = new Focusable(element)
focus.focusables // Array of focusable elements
element: The element, which subtree to search for focusable elements. Defaults todocument.documentElement.
Properties
Focusable has the following properties:
focusables- Array of keyboard focusable elementsfirstFocusable- First keyboard focusable elementlastFocusable- Last keyboard focusable element
Focusable has the following methods:
isFirstFocusable(el)- Returns true if the element is the first focusable.isLastFocusable(el)- Returns true if the element is the last focusable.