Created
April 9, 2013 17:18
-
-
Save ckundo/5347552 to your computer and use it in GitHub Desktop.
This js/jquery snippet will give focus to the first link in the main content area as defined by role='main'. This is a hack on top of the conventional 'skip navigation' link hack, that in many browsers does not change keyboard focus. It enhances the aria landmark role=main, which is widely supported by screen readers. Two birds with one stone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// <a href="#" id="skip-nav">Skip Navigation</a> | |
// <div role='main'> | |
// <a href="#">This receives focus on clicking skip nav</a> | |
// </div> | |
$('#skip-nav').click(function(e) { $("[role='main'] a:first").focus(); e.preventDefault(); }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment