@jsxtools/eslint-plugin-jsx-a11y
Version:
Static AST checker for accessibility rules on JSX elements for flat ESLint Config.
22 lines (19 loc) • 568 B
JavaScript
import { getProp, getLiteralPropValue } from '../module/jsx-ast-utils.js';
function getImplicitRoleForMenuitem(attributes) {
const type = getProp(attributes, "type");
if (type) {
const value = getLiteralPropValue(type) || "";
switch (typeof value === "string" && value.toUpperCase()) {
case "COMMAND":
return "menuitem";
case "CHECKBOX":
return "menuitemcheckbox";
case "RADIO":
return "menuitemradio";
default:
return "";
}
}
return "";
}
export { getImplicitRoleForMenuitem as default };