I am using the Venobox modal and need ADA support. I've tweaked a few things to make it work well, but I need one more piece. I need to focus to return to the element a.venobox
that opened the modal when the close button is pressed.
In another words, if the user was only tabbing through the site, opened the modal, then closed it, and tabbed again it would pick up where they left off.
I tried inserting a tabindex
but it only works for the first tab, then jumps back to the top of the page. Then, I tried adding something to hold the focus then return to it when closed, but I'm not the best with js.
Thanks
My Current Code:
$(document).ready(function(){
$('.venobox').venobox().click(function() {
$('.vbox-close').attr('tabindex', '1').attr('title','Close Modal');
var focusReturn = $(this).focus();
$(".vbox-close").click(function(){
return focusReturn;
});
});
});