@diegovelasquezweb/a11y-engine 0.11.4 → 0.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -888,7 +888,10 @@ function buildFindings(inputPayload, cliArgs) {
|
|
|
888
888
|
primary_selector: bestSelector,
|
|
889
889
|
actual: (() => {
|
|
890
890
|
const raw = firstNode?.failureSummary || `Found ${nodes.length} instance(s).`;
|
|
891
|
-
return raw
|
|
891
|
+
return raw
|
|
892
|
+
.replace(/^Fix (any|all) of the following:\s*/i, "")
|
|
893
|
+
.replace(/^(See|Reference):\s*https?:\/\/\S+\s*/i, "")
|
|
894
|
+
.trim();
|
|
892
895
|
})(),
|
|
893
896
|
primary_failure_mode: failureInsights.primaryFailureMode,
|
|
894
897
|
relationship_hint: failureInsights.relationshipHint,
|
|
@@ -1006,10 +1006,23 @@ async function runPa11yChecks(routeUrl, axeTags, sharedBrowser = null, includeWa
|
|
|
1006
1006
|
// Group issues by ruleId so each rule produces one violation (axe-style)
|
|
1007
1007
|
const groupedByRule = new Map();
|
|
1008
1008
|
|
|
1009
|
+
/**
|
|
1010
|
+
* Cleans raw pa11y messages — strips URL references, "Fix all/any of the following:" prefixes,
|
|
1011
|
+
* and other boilerplate that produces ugly titles in reports.
|
|
1012
|
+
*/
|
|
1013
|
+
function cleanPa11yMessage(msg) {
|
|
1014
|
+
if (!msg) return "Accessibility issue";
|
|
1015
|
+
return msg
|
|
1016
|
+
.replace(/^(See|Reference):\s*https?:\/\/\S+\s*/i, "")
|
|
1017
|
+
.replace(/^Fix (all|any) of the following:\s*/i, "")
|
|
1018
|
+
.trim();
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1009
1021
|
for (const issue of results.issues || []) {
|
|
1010
1022
|
if (issue.type === "notice") continue;
|
|
1011
1023
|
|
|
1012
1024
|
const impact = impactMap[issue.typeCode] || "moderate";
|
|
1025
|
+
const isWarning = issue.type === "warning";
|
|
1013
1026
|
|
|
1014
1027
|
let wcagCriterion = "";
|
|
1015
1028
|
const wcagMatch = issue.code?.match(/Guideline(\d+)_(\d+)\.(\d+)_(\d+)_(\d+)/);
|
|
@@ -1029,6 +1042,7 @@ async function runPa11yChecks(routeUrl, axeTags, sharedBrowser = null, includeWa
|
|
|
1029
1042
|
|
|
1030
1043
|
const ruleId = axeEquivId || `pa11y-${((issue.code || "unknown").split(".").pop() || "unknown").toLowerCase()}`;
|
|
1031
1044
|
const originalCode = issue.code || "unknown";
|
|
1045
|
+
const cleanMessage = cleanPa11yMessage(issue.message);
|
|
1032
1046
|
|
|
1033
1047
|
const node = {
|
|
1034
1048
|
any: [],
|
|
@@ -1037,13 +1051,13 @@ async function runPa11yChecks(routeUrl, axeTags, sharedBrowser = null, includeWa
|
|
|
1037
1051
|
data: { code: originalCode, context: issue.context?.slice(0, 200) },
|
|
1038
1052
|
relatedNodes: [],
|
|
1039
1053
|
impact,
|
|
1040
|
-
message:
|
|
1054
|
+
message: cleanMessage,
|
|
1041
1055
|
}],
|
|
1042
1056
|
none: [],
|
|
1043
1057
|
impact,
|
|
1044
1058
|
html: issue.context || "",
|
|
1045
1059
|
target: issue.selector ? [issue.selector] : [],
|
|
1046
|
-
failureSummary:
|
|
1060
|
+
failureSummary: cleanMessage,
|
|
1047
1061
|
};
|
|
1048
1062
|
|
|
1049
1063
|
if (groupedByRule.has(ruleId)) {
|
|
@@ -1055,13 +1069,14 @@ async function runPa11yChecks(routeUrl, axeTags, sharedBrowser = null, includeWa
|
|
|
1055
1069
|
id: ruleId,
|
|
1056
1070
|
impact,
|
|
1057
1071
|
tags: ["pa11y-check", ...(wcagCriterion ? [`wcag${wcagCriterion.replace(/\./g, "")}`] : [])],
|
|
1058
|
-
description:
|
|
1059
|
-
help:
|
|
1072
|
+
description: cleanMessage,
|
|
1073
|
+
help: cleanMessage.split(".")[0] || "Accessibility issue detected by HTML CodeSniffer",
|
|
1060
1074
|
helpUrl: wcagCriterion
|
|
1061
1075
|
? `https://www.w3.org/WAI/WCAG21/Understanding/${wcagCriterion.replace(/\./g, "")}`
|
|
1062
1076
|
: "https://squizlabs.github.io/HTML_CodeSniffer/",
|
|
1063
1077
|
source: "pa11y",
|
|
1064
1078
|
source_rule_id: originalCode,
|
|
1079
|
+
needs_verification: isWarning,
|
|
1065
1080
|
nodes: [node],
|
|
1066
1081
|
});
|
|
1067
1082
|
}
|