pmx-inert-elem
v2.0.0-0
Published
Module to manage the focusable state of an element and its children
Downloads
3
Readme
Inert Elem:
Intro
Module to manage the focusable state of an element and its children.
Getting Started
import inertElem from 'pmx-inert-elem';
const el = document.querySelector('.')
const inertStateHandler = inertElem({ elem: el });
// will make el and its children non focusable
inertStateHandler.isInert(false);
// will restore focus on el and children
inertStateHandler.isInert(false);
How to use
Setup
The module is exported as an UMD module so it can be used with AMD, CommonJS, ES Modules and in the browser.
- Install the dependency
Using
Yarn
yarn add pmx-inert-elem
or using NPM
npm install pmx-inert-elem --save
- Include the module
CommonJS
const inert = require('pmx-inert-elem').default;
ES2015 modules
import inert from 'pmx-inert-elem';
API
.isInert([Boolean])
true: Will make the element and its children non focusable false: Will restore its previous focus state
Browser Support
- IE 10+
- Chrome
- Firefox
- Safari
This library has been written with some ES2015 features that need to be polyfilled:
- Map
- Array.from