@jay-framework/a11y-validator 0.19.0 → 0.19.2
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/dist/index.js +26 -7
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { walkElements } from "@jay-framework/compiler-shared";
|
|
2
|
-
const INTERACTIVE_ELEMENTS = /* @__PURE__ */ new Set([
|
|
3
|
-
"a",
|
|
4
|
-
"button",
|
|
5
|
-
"input",
|
|
6
|
-
"select",
|
|
7
|
-
"textarea"
|
|
8
|
-
]);
|
|
2
|
+
const INTERACTIVE_ELEMENTS = /* @__PURE__ */ new Set(["a", "button", "input", "select", "textarea"]);
|
|
9
3
|
const NON_INTERACTIVE_ELEMENTS = /* @__PURE__ */ new Set([
|
|
10
4
|
"div",
|
|
11
5
|
"span",
|
|
@@ -214,6 +208,31 @@ const validate = (ctx) => {
|
|
|
214
208
|
}
|
|
215
209
|
}
|
|
216
210
|
});
|
|
211
|
+
if (ctx.head) {
|
|
212
|
+
const viewport = ctx.head.meta.find((m) => m.name?.toLowerCase() === "viewport");
|
|
213
|
+
if (viewport) {
|
|
214
|
+
const content = viewport.content.toLowerCase();
|
|
215
|
+
if (/user-scalable\s*=\s*no/.test(content)) {
|
|
216
|
+
findings.push({
|
|
217
|
+
severity: "error",
|
|
218
|
+
message: "Viewport meta disables user scaling (WCAG 1.4.4)",
|
|
219
|
+
suggestion: "Remove user-scalable=no from the viewport meta tag. Users must be able to zoom to at least 200%.",
|
|
220
|
+
element: "<meta>",
|
|
221
|
+
attribute: "content"
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
const maxScaleMatch = content.match(/maximum-scale\s*=\s*([\d.]+)/);
|
|
225
|
+
if (maxScaleMatch && parseFloat(maxScaleMatch[1]) < 2) {
|
|
226
|
+
findings.push({
|
|
227
|
+
severity: "error",
|
|
228
|
+
message: `Viewport meta restricts zoom to ${maxScaleMatch[1]}x (WCAG 1.4.4)`,
|
|
229
|
+
suggestion: "Set maximum-scale to at least 2, or remove it entirely. Users must be able to zoom to at least 200%.",
|
|
230
|
+
element: "<meta>",
|
|
231
|
+
attribute: "content"
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
217
236
|
return findings;
|
|
218
237
|
};
|
|
219
238
|
function checkLabel(el, tag, findings, labelForIds) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/a11y-validator",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Accessibility validation plugin for Jay Framework — checks jay-html templates for WCAG best practices",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"test": "vitest run"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@jay-framework/compiler-shared": "^0.19.
|
|
27
|
+
"@jay-framework/compiler-shared": "^0.19.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@jay-framework/dev-environment": "^0.19.
|
|
31
|
-
"@jay-framework/jay-stack-cli": "^0.19.
|
|
30
|
+
"@jay-framework/dev-environment": "^0.19.2",
|
|
31
|
+
"@jay-framework/jay-stack-cli": "^0.19.2",
|
|
32
32
|
"@types/node": "^22.15.21",
|
|
33
33
|
"node-html-parser": "^6.1.0",
|
|
34
34
|
"rimraf": "^5.0.5",
|