orionsoft-react-scripts
Version:
Orionsoft Configuration and scripts for Create React App.
15 lines (11 loc) • 317 B
JavaScript
import { getProp, getLiteralPropValue } from 'jsx-ast-utils';
/**
* Returns the implicit role for an img tag.
*/
export default function getImplicitRoleForImg(attributes) {
const alt = getProp(attributes, 'alt');
if (alt && getLiteralPropValue(alt) === '') {
return 'presentation';
}
return 'img';
}