UNPKG

@qualweb/util

Version:
14 lines (13 loc) 691 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function isPartOfSequentialFocusNavigation(element) { let tabIndexLessThanZero = false; const tabindex = element.getElementAttribute('tabindex'); const tabIndexExistsAndIsNumber = tabindex !== null && !isNaN(parseInt(tabindex, 10)); if (tabindex && tabIndexExistsAndIsNumber) { tabIndexLessThanZero = parseInt(tabindex, 10) < 0; } const focusable = window.AccessibilityUtils.isElementFocusable(element); return (focusable && tabIndexExistsAndIsNumber && !tabIndexLessThanZero) || (focusable && !tabIndexExistsAndIsNumber); } exports.default = isPartOfSequentialFocusNavigation;