@storybook/addon-a11y 10.3.3 → 10.3.4

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/manager.js CHANGED
@@ -31,7 +31,15 @@ var RuleType = {
31
31
  };
32
32
 
33
33
  // src/components/A11yContext.tsx
34
- import React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
34
+ import React, {
35
+ createContext,
36
+ useCallback,
37
+ useContext,
38
+ useEffect,
39
+ useMemo,
40
+ useRef,
41
+ useState
42
+ } from "react";
35
43
  import {
36
44
  STORY_CHANGED,
37
45
  STORY_FINISHED,
@@ -629,8 +637,15 @@ var unhighlightedSelectors = ["html", "body", "main"], theme = convert(themes.li
629
637
  }
630
638
  ), [setState, storyId]);
631
639
  let handleToggleHighlight = useCallback(() => {
632
- setState((prev) => ({ ...prev, ui: { ...prev.ui, highlighted: !prev.ui.highlighted } }));
633
- }, [setState]), [selectedItems, setSelectedItems] = useState(() => {
640
+ setState((prev) => ({
641
+ ...prev,
642
+ ui: { ...prev.ui, highlighted: !prev.ui.highlighted }
643
+ }));
644
+ }, [setState]), statusTimerRef = useRef(null);
645
+ useEffect(() => () => {
646
+ statusTimerRef.current !== null && clearTimeout(statusTimerRef.current);
647
+ }, []);
648
+ let [selectedItems, setSelectedItems] = useState(() => {
634
649
  let initialValue = /* @__PURE__ */ new Map();
635
650
  if (a11ySelection && /^[a-z]+.[a-z-]+.[0-9]+$/.test(a11ySelection)) {
636
651
  let [type, id] = a11ySelection.split(".");
@@ -665,8 +680,8 @@ var unhighlightedSelectors = ["html", "body", "main"], theme = convert(themes.li
665
680
  [setState]
666
681
  ), handleResult = useCallback(
667
682
  (axeResults, id) => {
668
- storyId === id && (setState((prev) => ({ ...prev, status: "ran", results: axeResults })), setTimeout(() => {
669
- setState((prev) => prev.status === "ran" ? { ...prev, status: "ready" } : prev), setSelectedItems((prev) => {
683
+ storyId === id && (setState((prev) => ({ ...prev, status: "ran", results: axeResults })), statusTimerRef.current !== null && clearTimeout(statusTimerRef.current), statusTimerRef.current = setTimeout(() => {
684
+ statusTimerRef.current = null, setState((prev) => prev.status === "ran" ? { ...prev, status: "ready" } : prev), setSelectedItems((prev) => {
670
685
  if (prev.size === 1) {
671
686
  let [key] = prev.values();
672
687
  document.getElementById(key)?.scrollIntoView({ behavior: "smooth", block: "center" });
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_vc79vlaxi5 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_vc79vlaxi5 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_vc79vlaxi5 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_ty2t0fl3iyg from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_ty2t0fl3iyg from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_ty2t0fl3iyg from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_vc79vlaxi5.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_vc79vlaxi5.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_vc79vlaxi5.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_ty2t0fl3iyg.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_ty2t0fl3iyg.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_ty2t0fl3iyg.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_vc79vlaxi5 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_vc79vlaxi5 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_vc79vlaxi5 from "node:module";
1
+ import CJS_COMPAT_NODE_URL_ty2t0fl3iyg from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_ty2t0fl3iyg from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_ty2t0fl3iyg from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_vc79vlaxi5.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_vc79vlaxi5.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_vc79vlaxi5.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_ty2t0fl3iyg.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_ty2t0fl3iyg.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_ty2t0fl3iyg.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-a11y",
3
- "version": "10.3.3",
3
+ "version": "10.3.4",
4
4
  "description": "Storybook Addon A11y: Test UI component compliance with WCAG web accessibility standards",
5
5
  "keywords": [
6
6
  "a11y",
@@ -73,7 +73,7 @@
73
73
  "vitest-axe": "^0.1.0"
74
74
  },
75
75
  "peerDependencies": {
76
- "storybook": "^10.3.3"
76
+ "storybook": "^10.3.4"
77
77
  },
78
78
  "publishConfig": {
79
79
  "access": "public"