diff --git a/lib/rules/role-supports-aria-props.js b/lib/rules/role-supports-aria-props.js index 370bb696..e1498fab 100644 --- a/lib/rules/role-supports-aria-props.js +++ b/lib/rules/role-supports-aria-props.js @@ -44,15 +44,16 @@ module.exports = { // - Get the element’s name const key = {name: getElementType(context, node)} // - Get the element’s disambiguating attributes - for (const prop of ['aria-expanded', 'type', 'size', 'role', 'href', 'multiple', 'scope']) { + for (const prop of ['alt', 'aria-expanded', 'type', 'size', 'role', 'href', 'multiple', 'scope']) { // - Only provide `aria-expanded` when it’s required for disambiguation if (prop === 'aria-expanded' && key.name !== 'summary') continue + if (prop === 'alt' && key.name !== 'img') continue const value = getPropValue(getProp(node.attributes, prop)) if (value) { if (!('attributes' in key)) { key.attributes = [] } - if (prop === 'href') { + if (prop === 'href' || prop === 'alt') { key.attributes.push({name: prop}) } else { key.attributes.push({name: prop, value})