@jsxtools/eslint-plugin-jsx-a11y
Version:
Static AST checker for accessibility rules on JSX elements for flat ESLint Config.
13 lines (10 loc) • 367 B
JavaScript
const jsxAstUtils = require('../module/jsx-ast-utils.cjs');
function getImplicitRoleForMenu(attributes) {
const type = jsxAstUtils.getProp(attributes, "type");
if (type) {
const value = jsxAstUtils.getLiteralPropValue(type);
return value && value.toUpperCase() === "TOOLBAR" ? "toolbar" : "";
}
return "";
}
module.exports = getImplicitRoleForMenu;