From a3c87b1a67523a54e78d9830f5947756beda2e5a Mon Sep 17 00:00:00 2001 From: imakewebthings Date: Fri, 6 Dec 2013 15:59:19 -0800 Subject: [PATCH] #47, set aria-hidden on show/hide goto form --- extensions/goto/deck.goto.js | 2 ++ test/spec.goto.js | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/extensions/goto/deck.goto.js b/extensions/goto/deck.goto.js index 459c87df..92053c83 100644 --- a/extensions/goto/deck.goto.js +++ b/extensions/goto/deck.goto.js @@ -152,6 +152,7 @@ the deck container. $.deck('extend', 'showGoTo', function() { var options = $.deck('getOptions'); $.deck('getContainer').addClass(options.classes.goto); + $(options.selectors.gotoForm).attr('aria-hidden', false); $(options.selectors.gotoInput).focus(); }); @@ -165,6 +166,7 @@ the deck container. var options = $.deck('getOptions'); $(options.selectors.gotoInput).blur(); $.deck('getContainer').removeClass(options.classes.goto); + $(options.selectors.gotoForm).attr('aria-hidden', true); }); /* diff --git a/test/spec.goto.js b/test/spec.goto.js index 91edd191..014f3fa2 100644 --- a/test/spec.goto.js +++ b/test/spec.goto.js @@ -23,6 +23,12 @@ describe('Deck JS Quick Go-To', function() { $.deck('showGoTo'); expect($(defaults.selectors.gotoInput)[0]).toEqual(document.activeElement); }); + + it('should set aria-hidden to false', function() { + var $gotoForm = $(defaults.selectors.gotoForm); + $.deck('showGoTo'); + expect($gotoForm).toHaveAttr('aria-hidden', 'false'); + }); }); describe('hideGoTo()', function() { @@ -38,6 +44,12 @@ describe('Deck JS Quick Go-To', function() { it('should blur the go-to input', function() { expect($(defaults.selectors.gotoInput)[0]).not.toEqual(document.activeElement); }); + + it('should set aria-hidden to true', function() { + var $gotoForm = $(defaults.selectors.gotoForm); + $.deck('hideGoTo'); + expect($gotoForm).toHaveAttr('aria-hidden', 'true'); + }); }); describe('toggleGoTo()', function() { @@ -139,4 +151,4 @@ describe('Deck JS Quick Go-To', function() { expect($.deck('getSlide')).toHaveId('slide-0'); }); }); -}); \ No newline at end of file +});