Naughty Programmer's Madness
    Wondering what’s next for npm?Check out our public roadmap! »

    makeup-screenreader-trap
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/makeup-screenreader-trap package

    0.2.1 • Public • Published

    makeup-screenreader-trap

    This module restricts screen reader virtual cursor to a single subtree in the DOM. This behaviour is useful when implementing a modal interface (e.g. a modal dialog).

    const screenreaderTrap = require('makeup-screenreader-trap');
     
    // trap an element
    screenreaderTrap.trap(document.querySelector('el'));
     
    // untrap the current trapped element
    screenreaderTrap.untrap();

    Experimental

    This CommonJS module is still in an experimental state, until it reaches v1.0.0 you must consider all minor releases as breaking changes. Patch releases may introduce new features, but will be backwards compatible.

    Install

    // via npm
    npm install makeup-screenreader-trap
     
    // via yarn
    yarn add makeup-screenreader-trap

    Options

    • useHiddenProperty: use hidden property instead of aria-hidden (default: false)

    Events

    • screenreaderTrap : fired by trapped element when screenreader trap is activated
    • screenreaderUntrap : fired by trapped element when screenreader trap is deactivated

    Dependencies

    Install

    npm i makeup-screenreader-trap

    DownloadsWeekly Downloads

    421

    Version

    0.2.1

    License

    MIT

    Unpacked Size

    10.2 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar