@jsxtools/eslint-plugin-jsx-a11y
Version:
Static AST checker for accessibility rules on JSX elements for flat ESLint Config.
15 lines (12 loc) • 506 B
JavaScript
const jsxAstUtils = require('./module/jsx-ast-utils.cjs');
const isHiddenFromScreenReader = (type, attributes) => {
if (type.toUpperCase() === "INPUT") {
const hidden = jsxAstUtils.getLiteralPropValue(jsxAstUtils.getProp(attributes, "type"));
if (hidden && hidden.toUpperCase() === "HIDDEN") {
return true;
}
}
const ariaHidden = jsxAstUtils.getPropValue(jsxAstUtils.getProp(attributes, "aria-hidden"));
return ariaHidden === true;
};
module.exports = isHiddenFromScreenReader;