@jay-framework/a11y-validator 0.19.1 → 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.
Files changed (2) hide show
  1. package/dist/index.js +25 -0
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -208,6 +208,31 @@ const validate = (ctx) => {
208
208
  }
209
209
  }
210
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
+ }
211
236
  return findings;
212
237
  };
213
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.1",
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.1"
27
+ "@jay-framework/compiler-shared": "^0.19.2"
28
28
  },
29
29
  "devDependencies": {
30
- "@jay-framework/dev-environment": "^0.19.1",
31
- "@jay-framework/jay-stack-cli": "^0.19.1",
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",