From 7f1f1affb015ba9b60c0d1782f4122b235d0d5c9 Mon Sep 17 00:00:00 2001 From: Daniel Korte Date: Sat, 2 Jun 2018 14:26:43 -0500 Subject: [PATCH 1/2] Replace aria-selected with aria-hidden --- js/cell.js | 4 ++-- js/slide.js | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js/cell.js b/js/cell.js index 5cb402d9..030c5ebd 100644 --- a/js/cell.js +++ b/js/cell.js @@ -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; }; @@ -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 ] = ''; }; diff --git a/js/slide.js b/js/slide.js index 9515bf8e..a7838ca5 100644 --- a/js/slide.js +++ b/js/slide.js @@ -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' ); + } }); }; From d7268e96288211d49cba2760eefdc7c5849f48fa Mon Sep 17 00:00:00 2001 From: Daniel Korte Date: Sat, 2 Jun 2018 14:28:16 -0500 Subject: [PATCH 2/2] Fix spacing --- js/slide.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/slide.js b/js/slide.js index a7838ca5..c8cfa7cc 100644 --- a/js/slide.js +++ b/js/slide.js @@ -63,7 +63,7 @@ proto.changeSelected = function( isSelected ) { var classMethod = isSelected ? 'add' : 'remove'; this.cells.forEach( function( cell ) { cell.element.classList[ classMethod ]('is-selected'); - if ( isSelected) { + if ( isSelected ) { cell.element.removeAttribute( 'aria-hidden' ); } else { cell.element.setAttribute( 'aria-hidden', 'true' );