From 20b9258d436c9d19bf015929312f1498d6112ee7 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Wed, 23 Oct 2013 17:14:34 -0400 Subject: [PATCH] Add in tabIndex to ensure that the tabbing works properly for link. LMS-1311 --- common/static/js/src/accessibility_tools.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/static/js/src/accessibility_tools.js b/common/static/js/src/accessibility_tools.js index 769dbc1223..9e315699d0 100644 --- a/common/static/js/src/accessibility_tools.js +++ b/common/static/js/src/accessibility_tools.js @@ -110,11 +110,14 @@ var accessible_modal = function(trigger, closeButtonId, modalId, mainPageId) { }); }; +// NOTE: This is a gross hack to make the skip links work for Webkit browsers +// see http://stackoverflow.com/questions/6280399/skip-links-not-working-in-chrome/12720183#12720183 + // handle things properly for clicks jQuery('#skip-link a').click(function() { var href = jQuery(this).attr('href'); if(href) { - jQuery(href).focus(); + jQuery(href).attr('tabIndex', -1).focus(); } }); // and for the enter key @@ -122,7 +125,7 @@ jQuery('#skip-link a').keypress(function(e) { if(e.which == 13) { var href = jQuery(this).attr('href'); if(href) { - jQuery(href).focus(); + jQuery(href).attr('tabIndex', -1).focus(); } } });