0.2.0 • Published 4 years ago

@zimpa/focus-trap v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

@zimpa/focus-trap

Trap the (keyboard) focus of an element with in a container element.

Install

Install the package by running npm install --save @zimpa/focus-trap.

Usage

// first create the trap, this an element where the focus stays when the client uses the TAB key.
const el = document.querySelector('.modal');
const trap = focusTrap(el);

// whenever you want to enable the trap use:
trap.enable();

// when you want to disable the trap use:
trap.disable();
0.2.0

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago