Sha256: 67b8e4062c6da6c75dc80a2fbddcd40a08ea2ee53c01f270bf2f037809deb7f2

Contents?: true

Size: 686 Bytes

Versions: 115

Compression:

Stored size: 686 Bytes

Contents

if (!options || !options.selector || typeof options.selector !== 'string') {
	throw new TypeError(
		'visible-in-page requires options.selector to be a string'
	);
}

let elms = axe.utils.querySelectorAll(virtualNode, options.selector);

// Filter elements that, within certain contexts, don't map their role.
// e.g. a <footer> inside a <main> is not a banner, but in the <body> context it is
if (typeof options.nativeScopeFilter === 'string') {
	elms = elms.filter(elm => {
		return (
			elm.actualNode.hasAttribute('role') ||
			!axe.commons.dom.findUpVirtual(elm, options.nativeScopeFilter)
		);
	});
}

this.relatedNodes(elms.map(elm => elm.actualNode));

return elms.length <= 1;

Version data entries

115 entries across 115 versions & 1 rubygems

Version Path
govuk_publishing_components-21.22.1 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.22.0 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.21.3 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.21.2 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.21.1 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.21.0 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.20.0 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.19.1 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.19.0 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.18.0 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.17.0 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.16.3 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.16.2 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.16.1 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.16.0 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.15.2 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.15.1 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.15.0 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.14.0 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js
govuk_publishing_components-21.13.5 node_modules/axe-core/lib/checks/keyboard/page-no-duplicate.js