MCPcopy
hub / github.com/microsoft/SandDance / isElementTabbable

Function isElementTabbable

docs/app/js/sanddance-app.js:24672–24685  ·  view source on GitHub ↗
(element, checkTabIndex)

Source from the content-addressed store, hash-verified

24670 element.isVisible === true; // used as a workaround for testing.
24671}
24672function isElementTabbable(element, checkTabIndex) {
24673 // If this element is null or is disabled, it is not considered tabbable.
24674 if (!element || element.disabled) return false;
24675 var tabIndex = 0;
24676 var tabIndexAttributeValue = null;
24677 if (element && element.getAttribute) {
24678 tabIndexAttributeValue = element.getAttribute("tabIndex");
24679 if (tabIndexAttributeValue) tabIndex = parseInt(tabIndexAttributeValue, 10);
24680 }
24681 var isFocusableAttribute = element.getAttribute ? element.getAttribute(IS_FOCUSABLE_ATTRIBUTE) : null;
24682 var isTabIndexSet = tabIndexAttributeValue !== null && tabIndex >= 0;
24683 var result = !!element && isFocusableAttribute !== "false" && (element.tagName === "A" || element.tagName === "BUTTON" || element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "SELECT" || isFocusableAttribute === "true" || isTabIndexSet);
24684 return checkTabIndex ? tabIndex !== -1 && result : result;
24685}
24686function isElementFocusZone(element) {
24687 return !!(element && element.getAttribute && !!element.getAttribute(FOCUSZONE_ID_ATTRIBUTE));
24688}

Callers 3

getPreviousElementFunction · 0.85
getNextElementFunction · 0.85
getFocusableByIndexPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected