Skip to content

Commit

Permalink
add console logs for debugging #1974
Browse files Browse the repository at this point in the history
  • Loading branch information
shunguoy committed Sep 13, 2024
1 parent 9b56ace commit 75ab2a6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion accessibility-checker-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"ts-node": "^10.5.0",
"typescript": "^4.5.4",
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1"
"webpack-cli": "^4.9.1",
"util": "^0.12.5"
},
"dependencies": {
"@types/react": "^17.0.37",
Expand Down
2 changes: 1 addition & 1 deletion accessibility-checker-engine/src/v2/dom/DOMWalker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class DOMWalker {
do {
elem = DOMWalker.parentNode(elem) as Element;
} while (elem && elem.nodeType !== 1);
//if (node.nodeName == 'MY-LIST-ITEM') console.log("walker node=" + node.nodeName +", role=" + (node as Element).getAttribute("role") +", parent=" + elem.nodeName +", parent nodetype=" + elem.nodeType +", id=" + elem.getAttribute("id") +", role=" + elem.getAttribute("role"));
if (node.nodeName == 'MY-LIST-ITEM') console.log("walker node=" + node.nodeName +", role=" + (node as Element).getAttribute("role") +", parent=" + elem.nodeName +", parent nodetype=" + elem.nodeType +", id=" + elem.getAttribute("id") +", role=" + elem.getAttribute("role"));
return elem;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ARIADefinitions } from "../../v2/aria/ARIADefinitions";
import { AriaUtil } from "../util/AriaUtil";
import { CommonUtil } from "../util/CommonUtil";
import { VisUtil } from "../util/VisUtil";
import { inspect } from "util";

export const aria_parent_required: Rule = {
id: "aria_parent_required",
Expand Down Expand Up @@ -52,8 +53,8 @@ export const aria_parent_required: Rule = {
act: "ff89c9",
run: (context: RuleContext, options?: {}, contextHierarchies?: RuleContextHierarchy): RuleResult | RuleResult[] => {
const ruleContext = context["dom"].node as HTMLElement;
//console.log("rule node="+ruleContext.nodeName + ", id="+ruleContext.getAttribute("id") +", roles=" + ruleContext.getAttribute("role"));

console.log("rule node="+ruleContext.nodeName + ", id="+ruleContext.getAttribute("id") +", roles=" + ruleContext.getAttribute("role")+ ", parent="+ ruleContext.parentElement.nodeName );
console.log("rule node="+ruleContext.nodeName + ", id="+ruleContext.getAttribute("id") +", contextHierarchies=" + inspect(contextHierarchies['aria']));
//skip the check if the element is hidden or disabled
if (VisUtil.isNodeHiddenFromAT(ruleContext) || CommonUtil.isNodeDisabled(ruleContext))
return;
Expand Down

0 comments on commit 75ab2a6

Please sign in to comment.