@pukanito/focusable
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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 to document.documentElement.

Properties

Focusable has the following properties:

  1. focusables - Array of keyboard focusable elements
  2. firstFocusable - First keyboard focusable element
  3. lastFocusable - Last keyboard focusable element

Focusable has the following methods:

  1. isFirstFocusable(el) - Returns true if the element is the first focusable.
  2. isLastFocusable(el) - Returns true if the element is the last focusable.

Package Sidebar

Install

npm i @pukanito/focusable

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

22.5 kB

Total Files

8

Last publish

Collaborators

  • pukanito