(rootElement, currentElement, checkNode, suppressParentTraversal, traverseChildren, includeElementsInFocusZones, allowFocusRoot, tabbable)
| 24612 | return false; |
| 24613 | } |
| 24614 | function getPreviousElement(rootElement, currentElement, checkNode, suppressParentTraversal, traverseChildren, includeElementsInFocusZones, allowFocusRoot, tabbable) { |
| 24615 | if (!currentElement || !allowFocusRoot && currentElement === rootElement) return null; |
| 24616 | var isCurrentElementVisible = isElementVisible(currentElement); |
| 24617 | // Check its children. |
| 24618 | if (traverseChildren && isCurrentElementVisible && (includeElementsInFocusZones || !(isElementFocusZone(currentElement) || isElementFocusSubZone(currentElement)))) { |
| 24619 | var childMatch = getPreviousElement(rootElement, currentElement.lastElementChild, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable); |
| 24620 | if (childMatch) { |
| 24621 | if (tabbable && isElementTabbable(childMatch, true) || !tabbable) return childMatch; |
| 24622 | var childMatchSiblingMatch = getPreviousElement(rootElement, childMatch.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable); |
| 24623 | if (childMatchSiblingMatch) return childMatchSiblingMatch; |
| 24624 | var childMatchParent = childMatch.parentElement; |
| 24625 | // At this point if we have not found any potential matches |
| 24626 | // start looking at the rest of the subtree under the currentParent. |
| 24627 | // NOTE: We do not want to recurse here because doing so could |
| 24628 | // cause elements to get skipped. |
| 24629 | while(childMatchParent && childMatchParent !== currentElement){ |
| 24630 | var childMatchParentMatch = getPreviousElement(rootElement, childMatchParent.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable); |
| 24631 | if (childMatchParentMatch) return childMatchParentMatch; |
| 24632 | childMatchParent = childMatchParent.parentElement; |
| 24633 | } |
| 24634 | } |
| 24635 | } |
| 24636 | // Check the current node, if it's not the first traversal. |
| 24637 | if (checkNode && isCurrentElementVisible && isElementTabbable(currentElement, tabbable)) return currentElement; |
| 24638 | // Check its previous sibling. |
| 24639 | var siblingMatch = getPreviousElement(rootElement, currentElement.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable); |
| 24640 | if (siblingMatch) return siblingMatch; |
| 24641 | // Check its parent. |
| 24642 | if (!suppressParentTraversal) return getPreviousElement(rootElement, currentElement.parentElement, true, false, false, includeElementsInFocusZones, allowFocusRoot, tabbable); |
| 24643 | return null; |
| 24644 | } |
| 24645 | function getNextElement(rootElement, currentElement, checkNode, suppressParentTraversal, suppressChildTraversal, includeElementsInFocusZones, allowFocusRoot, tabbable) { |
| 24646 | if (!currentElement || currentElement === rootElement && suppressChildTraversal && !allowFocusRoot) return null; |
| 24647 | var isCurrentElementVisible = isElementVisible(currentElement); |
no test coverage detected