pmx-inert-elem

2.0.0-0 • Public • Published

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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.0-04latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.0-04
1.0.00
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i pmx-inert-elem

Weekly Downloads

4

Version

2.0.0-0

License

none

Last publish

Collaborators

  • framini