diff --git a/lib/checks/keyboard/page-no-duplicate.js b/lib/checks/keyboard/page-no-duplicate.js index 7932656249..88322abf32 100644 --- a/lib/checks/keyboard/page-no-duplicate.js +++ b/lib/checks/keyboard/page-no-duplicate.js @@ -15,7 +15,7 @@ axe._cache.set(key, true); let elms = axe.utils.querySelectorAllFilter( axe._tree[0], options.selector, - elm => elm !== virtualNode + elm => elm !== virtualNode && axe.commons.dom.isVisible(elm.actualNode) ); // 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 ea454e4a4d..d1d3ccb1bb 100644 --- a/test/checks/keyboard/page-no-duplicate.js +++ b/test/checks/keyboard/page-no-duplicate.js @@ -50,6 +50,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', function() { + var options = { selector: 'main' }; + var params = checkSetup( + '