UNPKG

@jsxtools/eslint-plugin-jsx-a11y

Version:

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

15 lines (12 loc) 492 B
import { getLiteralPropValue, getProp, getPropValue } from './module/jsx-ast-utils.js'; const isHiddenFromScreenReader = (type, attributes) => { if (type.toUpperCase() === "INPUT") { const hidden = getLiteralPropValue(getProp(attributes, "type")); if (hidden && hidden.toUpperCase() === "HIDDEN") { return true; } } const ariaHidden = getPropValue(getProp(attributes, "aria-hidden")); return ariaHidden === true; }; export { isHiddenFromScreenReader as default };