@casoon/auditmysite
Version:
Professional website analysis suite with robust accessibility testing, Core Web Vitals performance monitoring, SEO analysis, and content optimization insights. Features isolated browser contexts, retry mechanisms, and comprehensive API endpoints for profe
92 lines • 3.38 kB
JavaScript
;
/**
* Accessibility Whitelist Configuration
*
* This file contains URL-specific whitelist rules for accessibility checks.
* Use this to document known false positives that cannot be automatically detected.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ACCESSIBILITY_WHITELIST = void 0;
exports.shouldIgnoreRule = shouldIgnoreRule;
exports.getWhitelistReason = getWhitelistReason;
/**
* Global accessibility whitelist
*
* Add entries here for known false positives that are manually verified.
*/
exports.ACCESSIBILITY_WHITELIST = [
{
url: 'https://www.casoon.de',
ignoreRules: {
'color-contrast': {
selectors: [
'.bg-white\\/20',
'[class*="backdrop-blur"]',
'h1.text-gray-800',
'h2.text-gray-700',
'p.text-gray-900'
],
reason: 'Glassmorphism effects with backdrop-blur. Manual verification confirms WCAG AA compliance: text-gray-700 (9.2:1), text-gray-800 (12.2:1), text-gray-900 (14.8:1). axe-core cannot calculate contrast on blurred backgrounds.',
addedDate: '2025-11-16',
verifiedBy: 'Manual WCAG contrast verification'
}
}
}
// Add more whitelist entries here as needed
];
/**
* Normalize URL for comparison (remove trailing slash, normalize protocol)
*/
function normalizeUrl(url) {
let normalized = url.trim().toLowerCase();
// Remove trailing slash
if (normalized.endsWith('/')) {
normalized = normalized.slice(0, -1);
}
// Normalize protocol
normalized = normalized.replace(/^https?:\/\//, '');
return normalized;
}
/**
* Check if a URL should ignore a specific rule based on whitelist
*/
function shouldIgnoreRule(url, ruleCode, selector) {
const normalizedUrl = normalizeUrl(url);
for (const entry of exports.ACCESSIBILITY_WHITELIST) {
// Check if URL matches (normalized comparison)
const normalizedEntry = normalizeUrl(entry.url);
const urlMatches = normalizedUrl === normalizedEntry || normalizedUrl.includes(normalizedEntry);
if (!urlMatches)
continue;
// Check if rule is whitelisted
const rule = entry.ignoreRules?.[ruleCode];
if (!rule)
continue;
// If no selectors specified, ignore all instances of this rule
if (!rule.selectors || rule.selectors.length === 0) {
return true;
}
// Check if selector matches
if (selector) {
const selectorMatches = rule.selectors.some(whitelistSel => selector.includes(whitelistSel) || whitelistSel.includes(selector));
if (selectorMatches) {
return true;
}
}
}
return false;
}
/**
* Get whitelist reason for a specific URL and rule
*/
function getWhitelistReason(url, ruleCode) {
const normalizedUrl = normalizeUrl(url);
for (const entry of exports.ACCESSIBILITY_WHITELIST) {
const normalizedEntry = normalizeUrl(entry.url);
if (normalizedUrl === normalizedEntry || normalizedUrl.includes(normalizedEntry)) {
return entry.ignoreRules?.[ruleCode]?.reason;
}
}
return undefined;
}
//# sourceMappingURL=accessibility-whitelist.js.map