# a11y-focus-store

> Accessibility util for storing/restoring focus.

Latest version **1.0.0** (published 2015-11-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install a11y-focus-store
pnpm add a11y-focus-store
yarn add a11y-focus-store
bun add a11y-focus-store
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-11-04 |
| First published | 2015-11-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | James Kyle |
| Maintainers | thejameskyle |
| Keywords | a11y, accessibility, focus, store, restore, aria |

## Links

- npm: https://www.npmjs.com/package/a11y-focus-store
- npm.io page: https://npm.io/package/a11y-focus-store

## Recent versions

- 1.0.0 (latest) — 2015-11-04

## README

# a11y-focus-store

> Accessibility util for storing/restoring focus.

## Installation

```sh
$ npm install --save a11y-focus-store
```

## Usage

```js
import {storeFocus, restoreFocus, clearStoredFocus} from 'a11y-focus-store';

document.body.innerHTML = `
  <button id="button-1">Button 1</button>
  <button id="button-2">Button 2</button>
  <button id="button-3">Button 3</button>
`;

var button1 = document.getElementById('button-1');
var button2 = document.getElementById('button-2');
var button3 = document.getElementById('button-3');

button1.focus();
storeFocus();

button2.focus();
restoreFocus();
// document.activeElement === button1;

button1.focus();
storeFocus();
clearStoredFocus();

innerButton.focus();
// document.activeElement === innerButton;

outerButton.focus();
// document.activeElement === container;

unscopeFocus();
outerButton.focus();
// document.activeElement === outerButton;
```

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