Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/WICG/inert

Polyfill for the inert attribute and property.
https://github.com/WICG/inert

Last synced: 3 months ago
JSON representation

Polyfill for the inert attribute and property.

Awesome Lists containing this project

README

        

The `inert` attribute/property allows web authors to mark parts of the DOM tree
as [inert](https://html.spec.whatwg.org/multipage/interaction.html#inert):

> When a node is inert, then the user agent must act as if the node was absent
> for the purposes of targeting user interaction events, may ignore the node for
> the purposes of text search user interfaces (commonly known as "find in
> page"), and may prevent the user from selecting text in that node.

Furthermore, a node which is **inert** should also be hidden from assistive
technology.

# Details

- Read the [Explainer](explainer.md).
- Read the [Spec](https://whatpr.org/html/4288/interaction.html#the-inert-attribute).
- Try the [Demo](https://wicg.github.io/inert/demo/).
- [Give feedback!](https://github.com/WICG/inert/issues)

# Polyfill

## Installation

`npm install --save wicg-inert`

We recommend only using versions of the polyfill that have been published to
npm, rather than cloning the repo and using the source directly. This helps
ensure the version you're using is stable and thoroughly tested.

This project provides two versions of the polyfill in `package.json`.

- `main`: Points at `dist/inert.js` which is transpiled to ES3.
- `module`: Points at `dist/inert.esm.js` which is transpiled to ES3.

_If you do want to build from source, make sure you clone the latest tag!_

## Usage

### 1. Either import the polyfill, or add the script to your page

```
import "wicg-inert";
```

OR…

```html
...