Skip to content

Commit

Permalink
[accessibility] add aria-hidden for icons so Screen Reader will ignor…
Browse files Browse the repository at this point in the history
…e them
  • Loading branch information
gasolin committed Jun 3, 2015
1 parent 92fff47 commit acc2ec1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gaia-list.js
Expand Up @@ -31,11 +31,19 @@ module.exports = component.register('gaia-list', {
this.setupShadowRoot();
this.els = { inner: this.shadowRoot.querySelector('.inner') };
this.addEventListener('click', this.onPointerDown);
this.makeAccessible();
// process everything that doesn't affect user interaction
// after the component is created
setTimeout(() => this.makeAccessible());
},

makeAccessible: function() {
[].forEach.call(this.children, (el) => { el.tabIndex = 0; });

// Make sure all icons are hidden from screen reader
var icons = this.getElementsByTagName('i');
for (var i = 0, len = icons.length; i < len; i++) {
icons[i].setAttribute('aria-hidden', true);
}
},

itemShouldRipple: function(el) {
Expand Down

0 comments on commit acc2ec1

Please sign in to comment.