diff --git a/lib/utils/get-role.js b/lib/utils/get-role.js index 8fea9178..54654ee8 100644 --- a/lib/utils/get-role.js +++ b/lib/utils/get-role.js @@ -46,6 +46,9 @@ function getRole(context, node) { const explicitRole = getLiteralPropValue(getProp(node.attributes, 'role')) if (explicitRole) { return explicitRole + } else if (getProp(node.attributes, 'role')) { + // If role is set to anything other than a literal prop + return undefined } // Assemble a key for looking-up the element’s role in the `elementRolesMap` diff --git a/tests/a11y-role-supports-aria-props.js b/tests/a11y-role-supports-aria-props.js index a367e454..424c363a 100644 --- a/tests/a11y-role-supports-aria-props.js +++ b/tests/a11y-role-supports-aria-props.js @@ -29,6 +29,18 @@ function getErrorMessage(attribute, role) { ruleTester.run('a11y-role-supports-aria-props', rule, { valid: [ + { + code: ` +
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: