JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5624
  • Score
    100M100P100Q159994F
  • License MIT

Restricts screen reader virtual cursor to a single subtree in the DOM

Package Exports

  • makeup-screenreader-trap

Readme

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).

import * as screenreaderTrap from "makeup-screenreader-trap";

// trap an element
screenreaderTrap.trap(document.querySelector("el"));

// untrap the current trapped element
screenreaderTrap.untrap();

Experimental

This module is still in an experimental state, until it reaches v1 you must consider all minor releases as breaking changes.

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