Skip to content

Commit

Permalink
fix(region): ignore direct child text nodes of body (#2050)
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Mar 6, 2020
1 parent 5ea339d commit fde31d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/checks/navigation/region.js
Expand Up @@ -66,8 +66,13 @@ function findRegionlessElms(virtualNode) {

return [];

// Return the node is a content element
} else if (dom.hasContent(node, /* noRecursion: */ true)) {
// Return the node is a content element. Ignore any direct text children
// of body so we don't report body as being outside of a landmark.
// @see https://github.com/dequelabs/axe-core/issues/2049
} else if (
node !== document.body &&
dom.hasContent(node, /* noRecursion: */ true)
) {
return [virtualNode];

// Recursively look at all child elements
Expand Down
2 changes: 2 additions & 0 deletions test/integration/full/region/region-fail.html
Expand Up @@ -37,6 +37,8 @@ <h1 id="mainheader" tabindex="0">This is a header.</h1>
</section>
</div>

This should be ignored

<main id="mocha"></main>
<script src="region-fail.js"></script>
<script src="/test/integration/adapter.js"></script>
Expand Down

0 comments on commit fde31d0

Please sign in to comment.