# @pukanito/focusable

> Get focusable child elements of a DOM element

Latest version **1.0.0** (published 2023-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @pukanito/focusable
pnpm add @pukanito/focusable
yarn add @pukanito/focusable
bun add @pukanito/focusable
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-11-19 |
| First published | 2023-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 22 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pukanito Forager |
| Maintainers | pukanito |
| Keywords | focustrap, focus, trap, accessibility |

## Links

- npm: https://www.npmjs.com/package/@pukanito/focusable
- Repository: https://github.com/pukanito/focustrap
- Homepage: https://github.com/pukanito/focustrap/tree/main/focusable
- Issues: https://github.com/pukanito/focustrap/issues
- npm.io page: https://npm.io/package/@pukanito/focusable

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads
- [@modern-js/plugin-swc](https://npm.io/package/@modern-js/plugin-swc.md) — 3.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-11-19
- 0.0.2 — 2023-11-13
- 0.0.1 — 2023-11-12

## README

# focusable

This library was generated with [Nx](https://nx.dev).

Finds keyboard-focusable elements within a specified element’s subtree.

Available on [npmjs.com](https://www.npmjs.com/package/@pukanito/focusable).

## Usage

In `package.json` add a dependency to 'focusable':

```json
{
  "dependencies": {
    "@pukanito/focusable": "1.0.0"
  }
}
```

Use `Focusable`:

```typescript
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
4. `firstFocusable` - First keyboard focusable element
5. `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.

---
_Source: https://npm.io/package/@pukanito/focusable · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
