Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

on-demand-live-region

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

on-demand-live-region

A module for editing content inline using an accessible contenteditable implementation

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5K
decreased by-11.75%
Maintainers
1
Weekly downloads
 
Created
Source

On Demand Live Regions

A tiny module for making screen readers announce text on demand, without a visual change to the interface. Initializing and using the live region is as simple as:

const liveRegion = new OnDemandLiveRegion()

liveRegion.say('Hello World!')

Installation

Just grab the minified version or install from NPM:

npm i on-demand-live-region

Settings object

  • level — the live region level (default: polite)
  • parent — the element to which the live region will be append (default: body)
  • idPrefix — the prefix for the unique id generated for the live region (default: live-region-)
  • delay — the delay in milliseconds before the phrase is announced (default: 0)

Assertive example with a half second delay

const liveRegionDelayed = new OnDemandLiveRegion({
  level: 'assertive',
  delay: 500
})

liveRegionDelayed.say('Hello World! (sorry, delayed reaction)')

You can override the delay setting in a second argument when calling say:

liveRegionDelayed.say('Hello World! (sorry, delayed reaction)', 1000)

Say it over and over

Each time you use the say method, the extant live region (if it exists) is destroyed and a new one created. This means you can reliably make the same announcement multiple times. This is not guaranteed in other implementations, where a persistent live region is repopulated.

Tested in

  • Safari with VoiceOver
  • Chrome with VoiceOver
  • IE11 with JAWS
  • Chrome with JAWS
  • Firefox with NVDA
  • Chrome with ChromeVox

FAQs

Package last updated on 23 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc