Tiny Accessible Focus Trapping Library – tab-fixation

Category: Javascript | July 7, 2022
AuthorTheOneAndOnlyZulu
Last UpdateJuly 7, 2022
LicenseMIT
Tags
Views34 views
Tiny Accessible Focus Trapping Library – tab-fixation

tab-fixation is a lightweight, performant, accessible JavaScript library for trapping focus within a DOM element.

How to use it:

1. Install and import the tab-fixation library.

# Yarn
$ yarn add tab-fixation
# NPM
$ npm i tab-fixation
import {initFixation, removeFixation} from "tab-fixation";

2. Initialize the tab-fixation on the target element.

initFixation(myElement);

3. Remove focus trapping from a specific element.

removeFixation(myElement);

You Might Be Interested In:


Leave a Reply