UNPKG

@jsxtools/eslint-plugin-jsx-a11y

Version:

Static AST checker for accessibility rules on JSX elements for flat ESLint Config.

14 lines (11 loc) 454 B
const jsxAstUtils = require('./module/jsx-ast-utils.cjs'); const getTabIndex = require('./getTabIndex.cjs'); const isInteractiveElement = require('./isInteractiveElement.cjs'); function isFocusable(type, attributes) { const tabIndex = getTabIndex(jsxAstUtils.getProp(attributes, "tabIndex")); if (isInteractiveElement(type, attributes)) { return tabIndex === void 0 || tabIndex >= 0; } return tabIndex >= 0; } module.exports = isFocusable;