Skip to content

Commit

Permalink
Fix defect in calling code when building the ElementRoleMap
Browse files Browse the repository at this point in the history
  • Loading branch information
samccone authored and ljharb committed Jul 4, 2024
1 parent f5b8f4c commit 92d9573
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/elementRoleMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,25 @@ for (let i = 0; i < keys.length; i++) {
if (relation.module === 'HTML') {
const concept = relation.concept;
if (concept) {
elementRoles.push([concept, [key]]);
const elementRoleRelation: ?ElementARIARoleRelationTuple = elementRoles.find(relation => ariaRoleRelationConceptAttributeEquals(relation[0], concept));
let roles: RoleSet;

if (elementRoleRelation) {
roles = elementRoleRelation[1];
} else {
roles = [];
}
let isUnique = true;
for (let i = 0; i < roles.length; i++) {
if (roles[i] === key) {
isUnique = false;
break;
}
}
if (isUnique) {
roles.push(key);
}
elementRoles.push([concept, roles]);
}
}
}
Expand Down

0 comments on commit 92d9573

Please sign in to comment.