From d505719fba5a666eb395999324146b77bc3d35ab Mon Sep 17 00:00:00 2001 From: J Potts Date: Wed, 1 Oct 2014 14:46:32 +0100 Subject: [PATCH] Refining tabindex setting on tab change All first-children of tab-content was having a tabindex assigned on the change of tab. This caused the unnecessary inclusion of non-form items in the tab ordering and wasn't required to make the tab content accessible. This change is to leave all tabindex attrs of the tab-content items alone, but leave the setting of the tabs themselves unaffected. --- js/foundation/foundation.tab.js | 10 +++++----- scss/foundation/components/_tabs.scss | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/js/foundation/foundation.tab.js b/js/foundation/foundation.tab.js index d45209606..b473343f7 100644 --- a/js/foundation/foundation.tab.js +++ b/js/foundation/foundation.tab.js @@ -142,9 +142,9 @@ 'aria-selected' : null }); $target.attr({ + 'tabindex' : '0', 'aria-selected' : true - }).removeAttr('tabindex') - .focus(); + }).focus(); } // Hide panels @@ -190,12 +190,12 @@ // window (notably in Chrome). // Clean up multiple attr instances to done once tab.addClass(settings.active_class).triggerHandler('opened'); - tab_link.attr({"aria-selected": "true"}).removeAttr('tabindex'); + tab_link.attr({"aria-selected": "true", tabindex: 0}); siblings.removeClass(settings.active_class) siblings.find('a').attr({"aria-selected": "false", tabindex: -1}); - target.siblings().removeClass(settings.active_class).attr({"aria-hidden": "true", tabindex: -1}).end().addClass(settings.active_class).attr('aria-hidden', 'false').find(':first-child').removeAttr('tabindex'); + target.siblings().removeClass(settings.active_class).attr({"aria-hidden": "true", tabindex: -1}); + target.addClass(settings.active_class).attr('aria-hidden', 'false').removeAttr("tabindex"); settings.callback(tab); - target.children().removeAttr('tabindex'); target.triggerHandler('toggled', [tab]); tabs.triggerHandler('toggled', [target]); diff --git a/scss/foundation/components/_tabs.scss b/scss/foundation/components/_tabs.scss index 99124d281..8676e0c47 100644 --- a/scss/foundation/components/_tabs.scss +++ b/scss/foundation/components/_tabs.scss @@ -121,7 +121,3 @@ $tabs-vertical-navigation-margin-bottom: 1.25rem !default; } } } - -[tabindex="-1"] { - outline: none; -} -- 2.47.2