forked from squizlabs/HTML_CodeSniffer
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Google Tag Manager recently switched to using iframes to load a service worker.
These iframes don't have a title but do have style="display: none;"
I don't think these should be recorded as failures:
Suggested fix:
HTMLCS.Util.js
/**
* Returns true if the element is deliberately hidden from Accessibility APIs.
*
* @param {Node} element The element to check.
*
* @return {Boolean}
*/
self.isAccessibilityHidden = function(element) {
do {
// WAI-ARIA presentation role.
if (element.hasAttribute('role') && element.getAttribute('role') === 'presentation') {
return true;
}
// WAI-ARIA hidden attribute.
if (element.hasAttribute('aria-hidden') && element.getAttribute('aria-hidden') === 'true') {
return true;
}
+ // CSS hidden attribute.
+ var style = self.style(element);
+ if (style !== null && style.display === 'none') {
+ return true;
+ }
+
// Consider iframes to be "invisible" as well, if the setting is set, so that
// checks don't run for external widgets we don't have control over.
if (element.tagName == 'IFRAME' && HTMLCS.getBosaOption('skipIframes') == true) {
return true;
}
} while (element = element.parentElement);
return false;
};Metadata
Metadata
Assignees
Labels
No labels