Skip to content

Commit 2548867

Browse files
committed
Merge branch 'sub-menu-changes' of github.com:browserstack/a11y-engine-axe-core into menu-result-changes
2 parents ac57923 + 8292c0a commit 2548867

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

lib/core/base/rule.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,13 +585,33 @@ Rule.prototype.after = function after(result, options) {
585585
// only add the node property for the check.after so we can
586586
// look at which iframe a check result came from, but we don't
587587
// want it for the final results object
588-
delete item.node;
588+
if (check.id === 'menu-expand' || check.id === 'menu-popup') {
589+
if (item?.data?.metaData) {
590+
delete item.node;
591+
item.result = true;
592+
}
593+
} else {
594+
delete item.node;
595+
}
589596
if (afterResults.indexOf(item) === -1) {
590597
item.filtered = true;
591598
}
592599
});
593600
});
594601

602+
// Trying for sub-menu
603+
if (result.id === 'menu-expand' || result.id === 'menu-popup') {
604+
const data = result.nodes.filter(r => !r.all[0].result);
605+
data.forEach(r => {
606+
const node = r.all[0].data;
607+
r.node = new axe.utils.DqElement(node);
608+
});
609+
610+
result.nodes.forEach(r => {
611+
delete r.all[0].data;
612+
});
613+
}
614+
595615
result.nodes = sanitizeNodes(result);
596616
return result;
597617
};

0 commit comments

Comments
 (0)