UNPKG

@jsxtools/eslint-plugin-jsx-a11y

Version:

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

19 lines (16 loc) 677 B
import { getProp, getPropValue, getLiteralPropValue } from './module/jsx-ast-utils.js'; const isDisabledElement = (attributes) => { const disabledAttr = getProp(attributes, "disabled"); const disabledAttrValue = getPropValue(disabledAttr); const isHTML5Disabled = disabledAttr && disabledAttrValue !== void 0; if (isHTML5Disabled) { return true; } const ariaDisabledAttr = getProp(attributes, "aria-disabled"); const ariaDisabledAttrValue = getLiteralPropValue(ariaDisabledAttr); if (ariaDisabledAttr && ariaDisabledAttrValue !== void 0 && ariaDisabledAttrValue === true) { return true; } return false; }; export { isDisabledElement as default };