Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

a11y-focus-store

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a11y-focus-store

Accessibility util for storing/restoring focus.

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
25K
decreased by-5.42%
Maintainers
1
Weekly downloads
 
Created
Source

a11y-focus-store

Accessibility util for storing/restoring focus.

Installation

$ npm install --save a11y-focus-store

Usage

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;

Keywords

FAQs

Package last updated on 04 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc