Skip to content

Commit

Permalink
Replace aria-selected with aria-hidden (#774)
Browse files Browse the repository at this point in the history
* Replace aria-selected with aria-hidden
  • Loading branch information
danielkorte authored and desandro committed Jan 24, 2019
1 parent 9296db2 commit 4475acf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var proto = Cell.prototype;

proto.create = function() {
this.element.style.position = 'absolute';
this.element.setAttribute( 'aria-selected', 'false' );
this.element.setAttribute( 'aria-hidden', 'true' );
this.x = 0;
this.shift = 0;
};
Expand All @@ -48,7 +48,7 @@ proto.destroy = function() {
// reset style
this.element.style.position = '';
var side = this.parent.originSide;
this.element.removeAttribute('aria-selected');
this.element.removeAttribute( 'aria-hidden' );
this.element.style[ side ] = '';
};

Expand Down
6 changes: 5 additions & 1 deletion js/slide.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ proto.changeSelected = function( isSelected ) {
var classMethod = isSelected ? 'add' : 'remove';
this.cells.forEach( function( cell ) {
cell.element.classList[ classMethod ]('is-selected');
cell.element.setAttribute( 'aria-selected', isSelected.toString() );
if ( isSelected ) {
cell.element.removeAttribute( 'aria-hidden' );
} else {
cell.element.setAttribute( 'aria-hidden', 'true' );
}
});
};

Expand Down

0 comments on commit 4475acf

Please sign in to comment.