From 381c23c6baa9d6bfa8ceabf60107e85749bc8b58 Mon Sep 17 00:00:00 2001 From: Tom Brunet Date: Thu, 27 May 2021 08:48:48 -0500 Subject: [PATCH] Header bug, reported by Benoit --- accessibility-checker-engine/src/v2/aria/ARIAMapper.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/accessibility-checker-engine/src/v2/aria/ARIAMapper.ts b/accessibility-checker-engine/src/v2/aria/ARIAMapper.ts index e0816d2a9..dd316acfc 100644 --- a/accessibility-checker-engine/src/v2/aria/ARIAMapper.ts +++ b/accessibility-checker-engine/src/v2/aria/ARIAMapper.ts @@ -568,14 +568,13 @@ export class ARIAMapper extends CommonMapper { "h6": "heading", "header": function(element) { let parent = element.parentNode; - let nodeName = parent.nodeName.toLowerCase(); // If nearest sectioningRoot or sectioningContent is body - while (parent) { + while (parent && parent.nodeType === 1) { + let nodeName = parent.nodeName.toLowerCase(); if (sectioningRoots[nodeName] || sectioningContent[nodeName]) { return (nodeName === "body") ? "banner" : null; } parent = parent.parentNode; - nodeName = parent.nodeName.toLowerCase(); } return null; },