You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
425 B

// Get all valid roles
let explicitRoles;
if (node.hasAttribute('role')) {
explicitRoles = node
.getAttribute('role')
.split(/\s+/i)
.filter(axe.commons.aria.isValidRole);
}
// Check valid roles if there are any, otherwise fall back to the inherited role
if (explicitRoles && explicitRoles.length > 0) {
return explicitRoles.includes('heading');
} else {
return axe.commons.aria.implicitRole(node) === 'heading';
}