Sha256: 71e09bf1c4069fa01e8ebafb332197a0b47897c3622365a28f8f739e240f8303
Contents?: true
Size: 901 Bytes
Versions: 11
Compression:
Stored size: 901 Bytes
Contents
/** * Applicability: * Rule applies to any element that has * a) a semantic role that is `widget` that supports name from content * b) has visible text content * c) has accessible name (eg: `aria-label`) */ const { aria, text } = axe.commons; const role = aria.getRole(node); if (!role) { return false; } const isWidgetType = aria.lookupTable.rolesOfType.widget.includes(role); if (!isWidgetType) { return false; } const rolesWithNameFromContents = aria.getRolesWithNameFromContents(); if (!rolesWithNameFromContents.includes(role)) { return false; } /** * if no `aria-label` or `aria-labelledby` attribute - ignore `node` */ if ( !text.sanitize(aria.arialabelText(virtualNode)) && !text.sanitize(aria.arialabelledbyText(node)) ) { return false; } /** * if no `contentText` - ignore `node` */ if (!text.sanitize(text.visibleVirtual(virtualNode))) { return false; } return true;
Version data entries
11 entries across 11 versions & 1 rubygems