wcag-scanner 1.2.63 → 1.2.64

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.
@@ -238,8 +238,15 @@ const WcagDevOverlay = ({ level = 'AA', rules, position = 'bottom-right', deboun
238
238
  clearAllHighlights();
239
239
  }, [open]);
240
240
  // ── Scan ────────────────────────────────────────────────────────────────
241
+ const scanningRef = (0, react_1.useRef)(false);
241
242
  const scan = (0, react_1.useCallback)(async () => {
243
+ var _a;
244
+ if (scanningRef.current)
245
+ return;
246
+ scanningRef.current = true;
242
247
  setScanning(true);
248
+ // Pause observer while scanning to prevent scan-triggered mutations causing rescans
249
+ (_a = observerRef.current) === null || _a === void 0 ? void 0 : _a.disconnect();
243
250
  try {
244
251
  const opts = { level, rules };
245
252
  const res = await (0, browserScanner_1.scanBrowserPage)(opts);
@@ -247,7 +254,17 @@ const WcagDevOverlay = ({ level = 'AA', rules, position = 'bottom-right', deboun
247
254
  setLastScan(new Date());
248
255
  }
249
256
  finally {
257
+ scanningRef.current = false;
250
258
  setScanning(false);
259
+ // Reconnect observer after scan settles
260
+ if (observerRef.current) {
261
+ observerRef.current.observe(document.body, {
262
+ childList: true,
263
+ subtree: true,
264
+ attributes: true,
265
+ attributeFilter: ['class', 'hidden', 'aria-hidden', 'role', 'alt', 'src', 'href'],
266
+ });
267
+ }
251
268
  }
252
269
  }, [level, rules]);
253
270
  (0, react_1.useEffect)(() => { scan(); }, [scan]);
@@ -265,7 +282,9 @@ const WcagDevOverlay = ({ level = 'AA', rules, position = 'bottom-right', deboun
265
282
  childList: true,
266
283
  subtree: true,
267
284
  attributes: true,
268
- attributeFilter: ['class', 'style', 'hidden', 'aria-hidden', 'role', 'alt', 'src', 'href'],
285
+ // 'style' intentionally excluded our highlight helper modifies inline styles
286
+ // on page elements which would cause an infinite rescan loop
287
+ attributeFilter: ['class', 'hidden', 'aria-hidden', 'role', 'alt', 'src', 'href'],
269
288
  });
270
289
  return () => {
271
290
  var _a;
@@ -413,13 +432,11 @@ const WcagDevOverlay = ({ level = 'AA', rules, position = 'bottom-right', deboun
413
432
  fontSize: 13,
414
433
  fontWeight: active ? 600 : 400,
415
434
  color: active ? '#7c3aed' : '#64748b',
416
- borderBottom: active ? '2px solid #7c3aed' : '2px solid transparent',
417
435
  cursor: 'pointer',
418
436
  background: 'none',
419
437
  border: 'none',
420
- borderBottomColor: active ? '#7c3aed' : 'transparent',
421
- borderBottomStyle: 'solid',
422
- borderBottomWidth: 2,
438
+ // Use inset box-shadow instead of borderBottom to avoid shorthand/longhand conflict
439
+ boxShadow: active ? 'inset 0 -2px 0 #7c3aed' : 'none',
423
440
  whiteSpace: 'nowrap',
424
441
  });
425
442
  const filterSelectStyle = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wcag-scanner",
3
- "version": "1.2.63",
3
+ "version": "1.2.64",
4
4
  "description": "Scan HTML for WCAG accessibility violations with AI-powered fix suggestions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",