let candidateSelectors = [ 'input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])', 'details>summary:first-of-type', 'details', ]; let candidateSelector = /* #__PURE__ */ candidateSelectors.join(','); let matches = typeof Element === 'undefined' ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; function tabbable(el, options) { options = options || {}; let regularTabbables = []; let orderedTabbables = []; let candidates = getCandidates( el, options.includeContainer, isNodeMatchingSelectorTabbable ); candidates.forEach(function (candidate, i) { let candidateTabindex = getTabindex(candidate); if (candidateTabindex === 0) { regularTabbables.push(candidate); } else { orderedTabbables.push({ documentOrder: i, tabIndex: candidateTabindex, node: candidate, }); } }); let tabbableNodes = orderedTabbables .sort(sortOrderedTabbables) .map((a) => a.node) .concat(regularTabbables); return tabbableNodes; } function focusable(el, options) { options = options || {}; let candidates = getCandidates( el, options.includeContainer, isNodeMatchingSelectorFocusable ); return candidates; } function getCandidates(el, includeContainer, filter) { let candidates = Array.prototype.slice.apply( el.querySelectorAll(candidateSelector) ); if (includeContainer && matches.call(el, candidateSelector)) { candidates.unshift(el); } candidates = candidates.filter(filter); return candidates; } function isNodeMatchingSelectorTabbable(node) { if ( !isNodeMatchingSelectorFocusable(node) || isNonTabbableRadio(node) || getTabindex(node) < 0 ) { return false; } return true; } function isTabbable(node) { if (!node) { throw new Error('No node provided'); } if (matches.call(node, candidateSelector) === false) { return false; } return isNodeMatchingSelectorTabbable(node); } function isNodeMatchingSelectorFocusable(node) { if ( node.disabled || isHiddenInput(node) || isHidden(node) || /* For a details element with a summary, the summary element gets the focused */ isDetailsWithSummary(node) ) { return false; } return true; } let focusableCandidateSelector = /* #__PURE__ */ candidateSelectors .concat('iframe') .join(','); function isFocusable(node) { if (!node) { throw new Error('No node provided'); } if (matches.call(node, focusableCandidateSelector) === false) { return false; } return isNodeMatchingSelectorFocusable(node); } function getTabindex(node) { let tabindexAttr = parseInt(node.getAttribute('tabindex'), 10); if (!isNaN(tabindexAttr)) { return tabindexAttr; } // Browsers do not return `tabIndex` correctly for contentEditable nodes; // so if they don't have a tabindex attribute specifically set, assume it's 0. if (isContentEditable(node)) { return 0; } // in Chrome,
,