MDL-49811 lib: Added js to skiplinks

I have added a JS module to handle skiplinks to send
the focus to the end of the block. This improves the function
and allows the user to better tab through the page.
This commit is contained in:
jinhofer
2015-08-19 11:05:07 -05:00
parent fd57d685c7
commit 0b7856efbe
5 changed files with 41 additions and 22 deletions

View File

@ -1828,3 +1828,17 @@ M.util.load_flowplayer = function() {
document.getElementsByTagName('head')[0].appendChild(fileref);
}
};
/**
* Initiates the listeners for skiplink interaction
*
* @param {YUI} Y
*/
M.util.init_skiplink = function(Y) {
Y.one(Y.config.doc.body).delegate('click', function(e) {
e.preventDefault();
e.stopPropagation();
Y.one(this.getAttribute('data-target')).focus();
return true;
}, 'a.skip');
};