@polymer/iron-a11y-announcer
Advanced tools
Comparing version 3.0.2 to 3.1.0
@@ -27,2 +27,8 @@ /** | ||
mode: string|null|undefined; | ||
/** | ||
* The timeout on refreshing the announcement text. Larger timeouts are | ||
* needed for certain screen readers to re-announce the same message. | ||
*/ | ||
timeout: number|null|undefined; | ||
_text: string|null|undefined; | ||
@@ -29,0 +35,0 @@ created(): void; |
@@ -46,6 +46,6 @@ /** | ||
@group Iron Elements | ||
@demo demo/index.html | ||
*/ | ||
export const IronA11yAnnouncer = Polymer({ | ||
/** @override */ | ||
_template: html` | ||
@@ -73,5 +73,12 @@ <style> | ||
_text: {type: String, value: ''} | ||
/** | ||
* The timeout on refreshing the announcement text. Larger timeouts are | ||
* needed for certain screen readers to re-announce the same message. | ||
*/ | ||
timeout: {type: Number, value: 150}, | ||
_text: {type: String, value: ''}, | ||
}, | ||
/** @override */ | ||
created: function() { | ||
@@ -82,4 +89,3 @@ if (!IronA11yAnnouncer.instance) { | ||
document.body.addEventListener( | ||
'iron-announce', this._onIronAnnounce.bind(this)); | ||
document.addEventListener('iron-announce', this._onIronAnnounce.bind(this)); | ||
}, | ||
@@ -96,3 +102,3 @@ | ||
this._text = text; | ||
}, 100); | ||
}, this.timeout); | ||
}, | ||
@@ -114,3 +120,9 @@ | ||
document.body.appendChild(IronA11yAnnouncer.instance); | ||
if (document.body) { | ||
document.body.appendChild(IronA11yAnnouncer.instance); | ||
} else { | ||
document.addEventListener('load', function() { | ||
document.body.appendChild(IronA11yAnnouncer.instance); | ||
}); | ||
} | ||
}; |
@@ -30,3 +30,3 @@ { | ||
}, | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"main": "iron-a11y-announcer.js", | ||
@@ -33,0 +33,0 @@ "author": "The Polymer Authors", |
18436
212