Last active
November 2, 2017 01:15
-
-
Save atsea/cf259c8487730bc69713164d1a92cc9e to your computer and use it in GitHub Desktop.
ARIA accessibile keyboard script allows disabled users to navigate the page left, right, up or down.
This file contains 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
/** | |
* SOCIAL SHARING TOOL BAR ARIA | |
* @type {[type]} | |
* @see https://dequeuniversity.com/library/aria/content-feedback/sf-social-toolbar | |
*/ | |
var $toolbar = $('#social-toolbar'); | |
var $items = $toolbar.find('li'); | |
$toolbar.on('keydown', '.button', function (e) { | |
var which = e.which; | |
var target = e.target; | |
if (which === 37 || which === 38) { // LEFT |or| UP | |
focusAdjacentItem(target, which, $items); | |
} else if (which === 39 || which === 40) { // RIGHT |or| DOWN | |
focusAdjacentItem(target, which, $items); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment