Get focusable elements inside a passed container and return as an array.
Parameters:
Name | Type | Description |
---|---|---|
container | Document | | The parent to search for focusable elements inside. |
- Since
- 1.0.0
- Source
Returns:
An array of focusable elements.
- Type:
- Array
Example
import { getFocusable } from "@gravityforms/utils";
function Example() {
const focusable = getFocusable( container );
// store first and last visible item
const firstFocusableEl = focusable[ 0 ];
const lastFocusableEl = focusable[ focusable.length - 1 ];
}