LiveRegion
Creates a configurable offscreen live region.
Installation
$ npm install live-region --save
Usage
var liveRegion = ;liveRegion;
This will create an offscreen live region:
Browserify/Webpack/whatever bundler you use
var LiveRegion = ;var liveRegion = ;
Configuration
var assertive = ariaLive: 'assertive' role: 'log' ariaRelevant: 'all' ariaAtomic: 'true';
Options
ariaLive
(String):"polite"
or"assertive"
- the desired value of thearia-live
attribute. Defaults to"polite"
.role
(String):"status"
,"alert"
, or"log"
- the desired value of therole
attribute. Defaults to"log"
.ariaRelevant
(String):"additions"
,"removals"
,"text"
,"all"
, or"additions text"
- the desired value of thearia-relevant
attribute. Defaults to"additions"
.ariaAtomic
(String):"true"
or"false"
- the desired value of thearia-atomic
attribute. Defaults to"false"
.
Methods
LiveRegion#announce
- @param
message
(String): the message to be announced - @param
expire
(Number): the number of ms to wait before cleaning up the inserted message. This prevents the region from getting full of useless nodes. Defaults to7000
. NOTE: to prevent the announcements from expiring, set tofalse
.
region;
LiveRegion#destroy
removes the live region DOM node inserted on initialization
region;