UNPKG

@jsxtools/eslint-plugin-jsx-a11y

Version:

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

19 lines (16 loc) 691 B
const jsxAstUtils = require('./module/jsx-ast-utils.cjs'); const isDisabledElement = (attributes) => { const disabledAttr = jsxAstUtils.getProp(attributes, "disabled"); const disabledAttrValue = jsxAstUtils.getPropValue(disabledAttr); const isHTML5Disabled = disabledAttr && disabledAttrValue !== void 0; if (isHTML5Disabled) { return true; } const ariaDisabledAttr = jsxAstUtils.getProp(attributes, "aria-disabled"); const ariaDisabledAttrValue = jsxAstUtils.getLiteralPropValue(ariaDisabledAttr); if (ariaDisabledAttr && ariaDisabledAttrValue !== void 0 && ariaDisabledAttrValue === true) { return true; } return false; }; module.exports = isDisabledElement;