in src/scanner/axe-utils.ts [77:95]
export function getImageCodedAs(node: HTMLElement): ImageCodedAs | null {
const role = node.getAttribute('role');
const alt = node.getAttribute('alt');
if (role === 'none' || role === 'presentation' || alt === '') {
return 'Decorative';
}
if (node.tagName.toLowerCase() !== 'img' && role !== 'img') {
// This covers implicitly decorative <svg>, <i>, and CSS background image cases
return 'Decorative';
}
if (getAccessibleText(node) !== '' || isWhiteSpace(alt)) {
return 'Meaningful';
}
return null;
}