Have ideas to improve npm?Join in the discussion! »

    aria-hidden
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.3 • Public • Published

    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

    Install

    npm i aria-hidden

    DownloadsWeekly Downloads

    190,756

    Version

    1.1.3

    License

    ISC

    Unpacked Size

    9.14 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar