Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions accessibility-checker-engine/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
//{ pattern: 'test/v2/checker/accessibility/rules/label_name_visible_ruleunit/label_offscreen.html', watched: true },
//{ pattern: 'test/v2/checker/accessibility/rules/aria_role_valid_ruleunit/td_attribute_invalid_copy.html', watched: true },
//{ pattern: 'test/v2/checker/accessibility/rules/text_block_heading_ruleunit/Headings-noneUsedEmphasizedText.html', watched: true },
{ pattern: 'test/v2/checker/accessibility/rules/aria_landmark_name_unique_ruleunit/*.html', watched: true },
//{ pattern: 'test/v2/checker/accessibility/rules/aria_landmark_name_unique_ruleunit/*.html', watched: true },
// { pattern: 'test/v2/checker/accessibility/rules/aria_parent_required_ruleunit/webComponentPass2.html', watched: true },


// { pattern: 'test/**/*_ruleunit/*.html', watched: true },
// { pattern: 'test/**/*_ruleunit/*.htm', watched: true },
{ pattern: 'test/**/*_ruleunit/*.html', watched: true },
{ pattern: 'test/**/*_ruleunit/*.htm', watched: true },
// all files ending in "_test"
// { pattern: 'test/*_test.js', watched: true },
{ pattern: 'test/**/*_test.js', watched: true }
Expand Down
41 changes: 39 additions & 2 deletions accessibility-checker-engine/src/v2/aria/ARIAMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,45 @@ export class ARIAMapper extends CommonMapper {
for (let iId=0; iId < ownIds.length; ++iId) {
const owned = doc.getElementById(ownIds[iId]);
//ignore if the aria-owns point to the element itself
if (owned && !DOMUtil.sameNode(owner, owned)) {
CacheUtil.setCache(owned, "aria-owned", owner);
//if (owned && !DOMUtil.sameNode(owner, owned)) {
// CacheUtil.setCache(owned, "aria-owned", owner);
//}
/**
* circular hierarchy check:
* (1) the owned element is neither the same element with the owner nor any ascendant of the owner
* (2) any child with aria-owns cannot point to the owner or any ascendant of the owner
*/
if (owned && !DOMUtil.sameNode(owner, owned)) {
// check if the owned with aria-owns that points to another element
let ownedNodes = [];
const sub_owners = owned.querySelectorAll("[aria-owns]");
for (let i = 0; i < sub_owners.length; ++i) {
const sub_owner = sub_owners[i];
const sub_ownIds = sub_owner.getAttribute("aria-owns").split(/ +/g);
for (let j=0; j < sub_ownIds.length; ++j) {
const ownedNode = doc.getElementById(sub_ownIds[j]);
if (ownedNode)
ownedNodes.push(ownedNode);
}
}
if (ownedNodes.length === 0) {
CacheUtil.setCache(owned, "aria-owned", owner);
continue;
}
// check if any aria-owns points to the element itself or any of it's parent
let parent : Element = owner;
let circular = false;
while (parent !== null) {
const found = ownedNodes.some(item => DOMUtil.sameNode(parent, item));
if (!found)
parent = DOMWalker.parentElement(parent);
else {
circular = true;
break;
}
}
if (!circular)
CacheUtil.setCache(owned, "aria-owned", owner);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en-US">

<head>
<title>Sandbox</title>
<meta charset="UTF-8" />
</head>

<body>
<div class="mm-panels">
<div id="mm-1" class="mm-panel mm-panel_opened">
<ul class="mm-listview">
<li class="mm-listitem"><a href="#mm-2" aria-owns="mm-2">Open submenu</a>
<li class="mm-listitem"><a href="#mm-3" aria-owns="mm-3">Open Another submenu</a>
</li>
</ul>
</div>
<div id="mm-3">
<div class="mm-navbar"><a href="#mm-1" aria-owns="mm-1">Close submenu</a>
</div>
</div>
</div>
</body>
<script>
UnitTest = {
ruleIds: ["aria_descendant_valid"],
results: [

]
}
</script>
</body>

</html>