Skip to content
🗣Cast aria-hidden to everything, except...
TypeScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__ feat: add track markers Mar 7, 2019
example initial commit Oct 23, 2018
src
.gitignore
.npmignore initial commit Oct 23, 2018
.nvmrc
.travis.yml initial commit Oct 23, 2018
README.md
package.json 1.1.1 Mar 9, 2019
tsconfig.json
yarn.lock feat: add track markers Mar 7, 2019

README.md

aria-hidden

NPM

Hides from ARIA everything, except provided node. Helps to isolate modal dialogs and focused task - the content will be not accessible using accesible tools.

API

Just call hideOthers with DOM-node you want to keep, and it will hide everything else. targetNode could be placed anywhere - its siblings would be hidden, but its parents - not.

import {hideOthers} from 'aria-hidden';

const undo = hideOthers(DOMnode);
// everything else is "aria-hidden"

undo();
// all changes undone

you also may limit the effect by providing top level node as a second paramiter

 hideOthers(targetNode, parentNode);
 hideOthers(anotherNode, document.getElementById('app'));
 // parentNode defaults to document.body 

Inspiration

Based on smooth-ui modal dialogs.

See also

Size

Code is 30 lines long

Licence

MIT

You can’t perform that action at this time.