jquery.tabbable
jquery.tabbable copied to clipboard
Adding options for disabling and enabling tabbable elements
These new functions are useful for disabling tabbing functionality behind modals, or in any other logical group.
One would either use this before creating a modal:
$.disableTabbing();
or if the element exists on the page:
$.disableTabbing({exclude: $(".modal")});
Either way, using this will return the page to normal:
$.enableTabbing();
It's important to note my changes update a core filter in jQuery, :hidden. It incorrectly includes inline elements with 0 offsetHeight & offsetWidth. I'm happy to resubmit without it, but in testing it seems core that it needs to be done. I've submitted a bug to jQuery on the matter.
Future updates: I'll likely teach tabIndexes[] to keep track of when the index doesn't actually exist as an attribute so it doesn't get added to elements which didn't have it previously.