1/**
2 * Toggle visibility of a content tab
3 * @param {String} selector Selector for the element
4 * @param {Node} toggle The element that triggered the tab
5 */
6var toggleVisibility = function (selector, toggle) {
7 if (!selector) return;
8 var elem = document.querySelector(selector);
9 if (!elem) return;
10 elem.classList.add('active');
11 if (toggle) {
12 toggle.classList.add('active');
13 }
14 elem.focus()
15 if (document.activeElement.matches(selector)) return;
16 elem.setAttribute('tabindex', '-1');
17 elem.focus();
18};
19