diff --git a/lib/checks/generic/page-no-duplicate-evaluate.js b/lib/checks/generic/page-no-duplicate-evaluate.js index 8a50c71e77..5d87ec0277 100644 --- a/lib/checks/generic/page-no-duplicate-evaluate.js +++ b/lib/checks/generic/page-no-duplicate-evaluate.js @@ -18,7 +18,7 @@ function pageNoDuplicateEvaluate(node, options, virtualNode) { cache.set(key, true); let elms = querySelectorAllFilter(axe._tree[0], options.selector, elm => - isVisible(elm.actualNode) + isVisible(elm.actualNode, true) ); // Filter elements that, within certain contexts, don't map their role. diff --git a/test/checks/keyboard/page-no-duplicate.js b/test/checks/keyboard/page-no-duplicate.js index 8d9d74f3f4..44f82ccefb 100644 --- a/test/checks/keyboard/page-no-duplicate.js +++ b/test/checks/keyboard/page-no-duplicate.js @@ -59,6 +59,15 @@ describe('page-no-duplicate', function() { assert.isTrue(check.evaluate.apply(checkContext, params)); }); + it('should return true if there is more than one element matching the selector but only one is visible to screenreaders', function() { + var options = { selector: 'main' }; + var params = checkSetup( + '