accented 0.0.0-20250618181418 → 0.0.0-20250701143712

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/README.md CHANGED
@@ -1,11 +1,71 @@
1
+ <a href="https://www.accented.dev">
2
+ <img alt="Accented" src="https://www.accented.dev/images/logo.svg" width="100" />
3
+ </a>
4
+
1
5
  # Accented
2
6
 
3
- Accented is a library that helps visually identify accessibility issues in a website or webapp under development.
7
+ Continuous accessibility testing and issue highlighting for web development.
8
+
9
+ ## What is Accented?
10
+
11
+ Accented is a visual library based on [axe-core](https://github.com/dequelabs/axe-core) that helps identify issues as soon as they are introduced.
12
+
13
+ It adds visual interactive callouts for all accessibility issues that axe-core identifies.
14
+
15
+ Example (without Accented / with Accented):
16
+
17
+ ![Two screenshots of the same web application side by side. On the left, the regular state of the application. On the right, the same state but with bright outlines and buttons added to some page elements.](https://www.accented.dev/images/side-by-side.png)
18
+
19
+ [Try it out on StackBlitz.](https://stackblitz.com/edit/accented-playground-react-ts?file=src%2Fmain.tsx)
20
+
21
+ Accented can complement other tools commonly used for accessibility testing:
22
+
23
+ - **It can find more issues than source code linting.** The popular [`eslint-plugin-jsx-a11y`](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) is great, and linters validate the whole codebase, but some types of issues can only be found on the rendered page. For example, the linter cannot find issues with color contrast or heading order. Besides, Accented is not framework-specific.
24
+ - **It’s embedded into the project code, with no setup required in the browser or code editor.** You get a similar accessibility audit using [Lighthouse](https://developer.chrome.com/docs/lighthouse/overview) or [axe DevTools](https://www.deque.com/axe/devtools/), but with Accented, you don’t need a browser extension, the results are always up-to-date, and all team members are guaranteed to see the same issues.
25
+ - **You don’t need to write any extra code, unlike with adding accessibility tests to a test suite.** You can test for accessibility issues in your test suite, for example using [`@axe-core/playwright`](https://www.npmjs.com/package/@axe-core/playwright). For that, however, you need to write a test case for every state of the application that you want to test. Accented instead automatically tests anything that’s currently on the page in your browser.
26
+
27
+ Learn more about Accented at [accented.dev](https://www.accented.dev).
28
+
29
+ ## Installation and usage
30
+
31
+ Install:
32
+
33
+ ```bash
34
+ npm install --save-dev accented
35
+ ```
36
+
37
+ Import and run at any moment during your app’s initialization:
38
+
39
+ ```js
40
+ if (isDevelopment) {
41
+ const { accented } = await import("accented");
42
+ accented();
43
+ }
44
+ ```
45
+
46
+ ⚠️ **Heads up!**
47
+ Don’t expose Accented to your users.
48
+ It’s only meant to be used in development.
49
+
50
+ See the docs for your bundler or framework for how to run code only in the development environment.
51
+
52
+ - [More detailed installation and usage guide](https://www.accented.dev/docs/installation-and-usage/)
53
+ - [Full API](https://www.accented.dev/docs/api/)
54
+
55
+ ## More info
56
+
57
+ - [Accessibility](https://www.accented.dev/docs/accessibility-statement/) (how accessible is Accented itself?)
58
+ - [Performance](https://www.accented.dev/docs/how-accented-works/#performance) (does Accented affect runtime performance of my app?)
59
+ - [Browser support](https://www.accented.dev/docs/browser-support-policy/) (will Accented work for me and my teammates?)
60
+ - [Versioning policy](https://www.accented.dev/docs/versioning-policy/) (Accented follows [SemVer](https://semver.org/))
61
+ - [Changelog](https://github.com/pomerantsev/accented/blob/main/packages/accented/CHANGELOG.md)
4
62
 
5
- It can be set up in only a few lines of code
63
+ ## Contributing
6
64
 
7
- It complements approaches to other means of continuous automated accessibility testing such as static code analysis and inclusion of accessibility tests in test suites. Think of it as a form of linting, but for a rendered web page rather than for source code.
65
+ Contributions are welcome!
8
66
 
9
- Accented uses the [axe-core](https://github.com/dequelabs/axe-core) testing engine.
67
+ - See [CONTRIBUTING.md](https://github.com/pomerantsev/accented/blob/main/CONTRIBUTING.md) for setup instructions and guidelines.
68
+ - Open an [issue](https://github.com/pomerantsev/accented/issues) or pull request if you spot a bug or want to propose a new feature.
69
+ - See [Milestones](https://github.com/pomerantsev/accented/milestones) to learn about our plans for Accented.
10
70
 
11
- TODO: example screenshots, without Accented / with Accented.
71
+ Have other ideas or feedback? Contact Pavel at [hello@pavelpomerantsev.com](mailto:hello@pavelpomerantsev.com).
@@ -1,11 +1,11 @@
1
1
  import type { AccentedOptions, DisableAccented } from './types.ts';
2
2
  export type { AccentedOptions, DisableAccented };
3
3
  /**
4
- * Enables highlighting of elements with accessibility issues.
4
+ * Enables the continuous scanning and highlighting of accessibility issues on the page.
5
5
  *
6
- * @param {AccentedOptions} options - The options object.
6
+ * @param {AccentedOptions} options - The options object (optional).
7
7
  *
8
- * @returns A `disable` function that can be called to stop the scanning and highlighting.
8
+ * @returns A `disable` function that takes no parameters. When called, disables the scanning and highlighting, and cleans up any changes that Accented has made to the page.
9
9
  *
10
10
  * @example
11
11
  * accented();
@@ -20,8 +20,8 @@ export type { AccentedOptions, DisableAccented };
20
20
  * leading: false
21
21
  * },
22
22
  * callback: ({ elementsWithIssues, performance }) => {
23
- * console.log('Elements with issues:', elementsWithIssues);
24
- * console.log('Total blocking time:', performance.totalBlockingTime);
23
+ * console.log('Elements with issues:', elementsWithIssues);
24
+ * console.log('Total blocking time:', performance.totalBlockingTime);
25
25
  * }
26
26
  * });
27
27
  */
@@ -1 +1 @@
1
- {"version":3,"file":"accented.d.ts","sourceRoot":"","sources":["../src/accented.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAMnE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,eAAe,CAwFvE"}
1
+ {"version":3,"file":"accented.d.ts","sourceRoot":"","sources":["../src/accented.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAMnE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,eAAe,CAuFvE"}
package/dist/accented.js CHANGED
@@ -13,11 +13,11 @@ import { deepMerge } from './utils/deep-merge.js';
13
13
  import { supportsAnchorPositioning } from './utils/supports-anchor-positioning.js';
14
14
  import { validateOptions } from './validate-options.js';
15
15
  /**
16
- * Enables highlighting of elements with accessibility issues.
16
+ * Enables the continuous scanning and highlighting of accessibility issues on the page.
17
17
  *
18
- * @param {AccentedOptions} options - The options object.
18
+ * @param {AccentedOptions} options - The options object (optional).
19
19
  *
20
- * @returns A `disable` function that can be called to stop the scanning and highlighting.
20
+ * @returns A `disable` function that takes no parameters. When called, disables the scanning and highlighting, and cleans up any changes that Accented has made to the page.
21
21
  *
22
22
  * @example
23
23
  * accented();
@@ -32,8 +32,8 @@ import { validateOptions } from './validate-options.js';
32
32
  * leading: false
33
33
  * },
34
34
  * callback: ({ elementsWithIssues, performance }) => {
35
- * console.log('Elements with issues:', elementsWithIssues);
36
- * console.log('Total blocking time:', performance.totalBlockingTime);
35
+ * console.log('Elements with issues:', elementsWithIssues);
36
+ * console.log('Total blocking time:', performance.totalBlockingTime);
37
37
  * }
38
38
  * });
39
39
  */
@@ -68,8 +68,7 @@ export function accented(options = {}) {
68
68
  const { context, axeOptions, name, output, throttle, callback } = deepMerge(defaultOptions, options);
69
69
  if (enabled.value) {
70
70
  // Add link to the recipes section of the docs (#56).
71
- console.warn('You are trying to run the Accented library more than once. ' +
72
- 'This will likely lead to errors.');
71
+ console.warn('You are trying to run the Accented library more than once, which may lead to errors.');
73
72
  console.trace();
74
73
  }
75
74
  enabled.value = true;
@@ -1 +1 @@
1
- {"version":3,"file":"accented.js","sourceRoot":"","sources":["../src/accented.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,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,EAAE,CAAC;gBACf,aAAa,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,aAAa,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare const accentedUrl = "https://www.npmjs.com/package/accented";
1
+ export declare const accentedUrl = "https://www.accented.dev";
2
2
  export declare const issuesUrl = "https://github.com/pomerantsev/accented/issues";
3
3
  export declare const getAccentedElementNames: (name: string) => string[];
4
4
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,2CAA2C,CAAC;AACpE,eAAO,MAAM,SAAS,mDAAmD,CAAC;AAC1E,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,aAA0C,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,6BAA6B,CAAC;AACtD,eAAO,MAAM,SAAS,mDAAmD,CAAC;AAC1E,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,aAA0C,CAAC"}
package/dist/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const accentedUrl = 'https://www.npmjs.com/package/accented';
1
+ export const accentedUrl = 'https://www.accented.dev';
2
2
  export const issuesUrl = 'https://github.com/pomerantsev/accented/issues';
3
3
  export const getAccentedElementNames = (name) => [`${name}-trigger`, `${name}-dialog`];
4
4
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,wCAAwC,CAAC;AACpE,MAAM,CAAC,MAAM,SAAS,GAAG,gDAAgD,CAAC;AAC1E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,UAAU,EAAE,GAAG,IAAI,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,0BAA0B,CAAC;AACtD,MAAM,CAAC,MAAM,SAAS,GAAG,gDAAgD,CAAC;AAC1E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,UAAU,EAAE,GAAG,IAAI,SAAS,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"accented-trigger.d.ts","sourceRoot":"","sources":["../../src/elements/accented-trigger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;CACtC;AAID,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM;;iCAsEzB,eAAe,GAAG,SAAS;4CAEhB,eAAe,GAAG,SAAS;yCAE9B,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;2CAEtB,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;yCAE1B,gBAAgB,GAAG,SAAS;iBAE7C,OAAO,GAAG,SAAS;gBAEpB,cAAc,GAA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gB,GAAG,SAAS;iBAE7C,OAAO,GAAG,SAAS;gBAEpB,cAAc,GAAG,SAAS;kBAExB,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS;iBAE7B,MAAM,CAAC,OAAO,CAAC,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgJvC,CAAC"}
@@ -30,6 +30,8 @@ export const getAccentedTrigger = (name) => {
30
30
  #trigger {
31
31
  pointer-events: auto;
32
32
 
33
+ user-select: none;
34
+
33
35
  margin-inline-start: auto;
34
36
  margin-inline-end: 4px;
35
37
  margin-block-start: 4px;
@@ -1 +1 @@
1
- {"version":3,"file":"accented-trigger.js","sourceRoot":"","sources":["../../src/elements/accented-trigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAUpF,0EAA0E;AAC1E,+FAA+F;AAC/F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,EAAE;IACjD,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAEpD,qHAAqH;IACrH,yFAAyF;IACzF,yFAAyF;IACzF,wCAAwC;IACxC,uGAAuG;I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EAAE,QAAQ,CAAC,QAAQ,CAAC,EAC5B,QAAQ,EAAE,QAAQ,cAuJnB"}
1
+ {"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../src/scanner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQ1E,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAC5B,QAAQ,EAAE,QAAQ,cAyJnB"}
package/dist/scanner.js CHANGED
@@ -27,12 +27,14 @@ export function createScanner(name, context, axeOptions, throttle, callback) {
27
27
  try {
28
28
  result = await axe.run(scanContext, {
29
29
  elementRef: true,
30
- // Although axe-core can perform iframe scanning, I haven't succeeded in it,
31
- // and the docs suggest that the axe-core script should be explicitly included
32
- // in each of the iframed documents anyway.
33
- // It seems preferable to disallow iframe scanning and not report issues in elements within iframes
34
- // in the case that such issues are for some reason reported by axe-core.
35
- // A consumer of Accented can instead scan the iframed document by calling Accented initialization from that document.
30
+ /**
31
+ * Although axe-core can perform iframe scanning, I haven't succeeded in it,
32
+ * and the docs suggest that the axe-core script should be explicitly included
33
+ * in each of the iframed documents anyway.
34
+ * It seems preferable to disallow iframe scanning and not report issues in elements within iframes
35
+ * in the case that such issues are for some reason reported by axe-core.
36
+ * A consumer of Accented can instead scan the iframed document by calling Accented initialization from that document.
37
+ */
36
38
  iframes: false,
37
39
  resultTypes: ['violations'],
38
40
  ...axeOptions,
@@ -58,15 +60,15 @@ export function createScanner(name, context, axeOptions, throttle, callback) {
58
60
  const domUpdateMeasure = performance.measure('dom-update', 'dom-update-start');
59
61
  const domUpdateDuration = Math.round(domUpdateMeasure.duration);
60
62
  callback({
63
+ // Assuming that the {include, exclude} shape of the context object will be used less often
64
+ // than other variants, we'll output just the `include` array in case nothing is excluded
65
+ // in the scan.
66
+ scanContext: scanContext.exclude.length > 0 ? scanContext : scanContext.include,
61
67
  elementsWithIssues: elementsWithIssues.value,
62
68
  performance: {
63
69
  totalBlockingTime: scanDuration + domUpdateDuration,
64
70
  scan: scanDuration,
65
71
  domUpdate: domUpdateDuration,
66
- // Assuming that the {include, exclude} shape of the context object will be used less often
67
- // than other variants, we'll output just the `include` array in case nothing is excluded
68
- // in the scan.
69
- scanContext: scanContext.exclude.length > 0 ? scanContext : scanContext.include,
70
72
  },
71
73
  });
72
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scanner.js","sourceRoot":"","sources":["../src/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AACrG,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,OAAgB,EAChB,UAAsB,EACtB,QAA4B,EAC5B,QAAkB;IAElB,MAAM,oBAAoB,GAAG,KAAK,IAAI,gBAAgB,CAAC;IACvD,MAAM,GAAG,GAAG,MAA4C,CAAC;IACzD,MAAM,SAAS,GAAG,IAAI,SAA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AO,KAAK,CAAC;YACf,CAAC,EACD,IAAI,GAAG,EAAQ,CAChB,CAAC;YAEF,MAAM,oBAAoB,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC,cAAc,EAAE,EAAE;gBACjF,OAAO,CAAC,oCAAoC,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC1E,CAAC,CAAC,CAAC;YAEH,MAAM,KAAK,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAClF,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE;QACjC,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;IAEH,OAAO,GAAG,EAAE;QACV,gBAAgB,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC,CAAC;AACJ,CAAC"}
package/dist/types.d.ts CHANGED
@@ -3,25 +3,37 @@ import type axe from 'axe-core';
3
3
  import type { AccentedTrigger } from './elements/accented-trigger.ts';
4
4
  export type Throttle = {
5
5
  /**
6
- * The minimal time between scans.
6
+ * How long Accented must wait (in milliseconds) to run a scan after a mutation or after the previous scan (whichever finished last).
7
7
  *
8
- * Default: `1000`.
8
+ * If the page you’re scanning has a lot of nodes,
9
+ * scanning may take a noticeable time (~ a few hundred milliseconds),
10
+ * during which time the main thread will be blocked most of the time.
11
+ *
12
+ * You may want to experiment with this value if your page contents change frequently
13
+ * or if it has JavaScript-based animations running on the main thread.
14
+ *
15
+ * @default 1000
9
16
  * */
10
17
  wait?: number;
11
18
  /**
12
- * When to run the scan on Accented initialization or on a mutation.
19
+ * If `leading` is set to `true`, the scan runs immediately after a mutation.
20
+ * In this case, `wait` only applies to subsequent scans,
21
+ * giving the page at least `wait` milliseconds between the end of the previous scan
22
+ * and the beginning of the next one.
13
23
  *
14
- * If `true`, the scan will run immediately. If `false`, the scan will run after the first throttle delay.
24
+ * If `leading` is set to `false`, the wait applies to mutations as well,
25
+ * delaying the output.
26
+ * This may be useful if you’re expecting quick bursts of mutations on your page.
15
27
  *
16
- * Default: `true`.
28
+ * @default true
17
29
  * */
18
30
  leading?: boolean;
19
31
  };
20
32
  export type Output = {
21
33
  /**
22
- * Whether to output the issues to the console.
34
+ * Whether the list of elements with issues should be printed to the browser console whenever issues are added, removed, or changed.
23
35
  *
24
- * Default: `true`.
36
+ * @default true
25
37
  * */
26
38
  console?: boolean;
27
39
  };
@@ -44,44 +56,29 @@ export declare const allowedAxeOptions: readonly ["rules", "runOnly"];
44
56
  export type AxeOptions = Pick<axe.RunOptions, (typeof allowedAxeOptions)[number]>;
45
57
  type CallbackParams = {
46
58
  /**
47
- * The most current array of elements with issues.
59
+ * The most up-to-date array of all elements with accessibility issues.
48
60
  * */
49
61
  elementsWithIssues: Array<ElementWithIssues>;
50
62
  /**
51
- * * `performance`: runtime performance of the last scan. An object:
52
- * * `totalBlockingTime`: how long the main thread was blocked by Accented during the last scan, in milliseconds.
63
+ * Runtime performance of the last scan. An object with the following props:
64
+ * - `totalBlockingTime`: how long the main thread was blocked by Accented during the last scan, in milliseconds.
53
65
  * It’s further divided into the `scan` and `domUpdate` phases.
54
- * * `scan`: how long the `scan` phase took, in milliseconds.
55
- * * `domUpdate`: how long the `domUpdate` phase took, in milliseconds.
56
- * * `scanContext`: nodes that got scanned. Either an array of nodes,
57
- * or an object with `include` and `exclude` properties (if any nodes were excluded).
66
+ * - `scan`: how long scanning (the execution of `axe.run()`) took, in milliseconds.
67
+ * - `domUpdate`: how long the DOM update (adding / removing outlines and dialog trigger buttons) took, in milliseconds.
58
68
  * */
59
69
  performance: {
60
70
  totalBlockingTime: number;
61
71
  scan: number;
62
72
  domUpdate: number;
63
- scanContext: ScanContext | Array<Node>;
64
73
  };
74
+ /**
75
+ * Nodes that got scanned. Either an array of nodes,
76
+ * or an object with `include` and `exclude` properties (if any nodes were excluded).
77
+ */
78
+ scanContext: ScanContext | Array<Node>;
65
79
  };
66
80
  export type Callback = (params: CallbackParams) => void;
67
81
  export type AccentedOptions = {
68
- /**
69
- * The `context` parameter for `axe.run()`.
70
- *
71
- * Determines what element(s) to scan for accessibility issues.
72
- *
73
- * Accepts a variety of shapes:
74
- * * an element reference;
75
- * * a selector;
76
- * * a `NodeList`;
77
- * * an include / exclude object;
78
- * * and more.
79
- *
80
- * See documentation: https://www.deque.com/axe/core-documentation/api-documentation/#context-parameter
81
- *
82
- * Default: `document`.
83
- */
84
- context?: Context;
85
82
  /**
86
83
  * The `options` parameter for `axe.run()`.
87
84
  *
@@ -94,13 +91,70 @@ export type AccentedOptions = {
94
91
  *
95
92
  * See documentation: https://www.deque.com/axe/core-documentation/api-documentation/#options-parameter
96
93
  *
97
- * Default: `{}`.
94
+ * @default {}
98
95
  */
99
96
  axeOptions?: AxeOptions;
97
+ /**
98
+ * A function that will be called after each scan.
99
+ *
100
+ * Potential uses:
101
+
102
+ * - do something with the scan results,
103
+ * for example send them to a backend for storage and analysis;
104
+ * - analyze Accented’s performance.
105
+ *
106
+ * @default () => {}
107
+ *
108
+ * @example
109
+ *
110
+ * accented({
111
+ * callback: ({ elementsWithIssues, performance, scanContext }) => {
112
+ * console.log('Elements with issues:', elementsWithIssues);
113
+ * console.log('Total blocking time:', performance.totalBlockingTime);
114
+ * console.log('Scan context:', scanContext);
115
+ * }
116
+ * });
117
+ *
118
+ * */
119
+ callback?: Callback;
120
+ /**
121
+ * The `context` parameter for `axe.run()`.
122
+ *
123
+ * Determines what part(s) of the page to scan for accessibility issues.
124
+ *
125
+ * Accepts a variety of shapes:
126
+ *
127
+ * - a [`Node`](https://developer.mozilla.org/en-US/docs/Web/API/Node) (in practice it will likely be an instance of [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element), [`Document`](https://developer.mozilla.org/en-US/docs/Web/API/Document), or [`DocumentFragment`](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment));
128
+ * - a valid [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors);
129
+ * - an object for selecting elements within shadow DOM,
130
+ * whose shape is `{ fromShadowDom: [selector1, selector2, ...] }`,
131
+ * where `selector1`, `selector2`, etc. select shadow hosts, and the last selector selects the actual context.
132
+ * `selector2` in this example is _within_ the shadow root created on the element(s) that match `selector1`,
133
+ * so in practice you shouldn’t have more than two elements in such an array
134
+ * unless you have a very complex structure with multiple shadow DOM layers;
135
+ * - a [`NodeList`](https://developer.mozilla.org/en-US/docs/Web/API/NodeList) (likely a result of a [`querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) call);
136
+ * - an array containing any combination of selectors, nodes, or shadow DOM objects (described above);
137
+ * - an object containing `include` and / or `exclude` properties.
138
+ * It’s useful if you’d like to exclude certain elements or parts of the page.
139
+ * The values for `include` and `exclude` can take any of the above shapes.
140
+ * It’s unlikely that you’d want to have complex `include` / `exclude` rules,
141
+ * but if you do, the exact behavior is documented by the relevant tests:
142
+ * [`is-node-in-scan-context.test.ts`](https://github.com/pomerantsev/accented/blob/main/packages/accented/src/utils/is-node-in-scan-context.test.ts).
143
+ *
144
+ * See also the documentation for the [`context` parameter of `axe.run()`](https://www.deque.com/axe/core-documentation/api-documentation/#context-parameter),
145
+ * which the `context` option from Accented mostly mirrors
146
+ * (note that Accented doesn’t support the `fromFrames` object shape).
147
+ *
148
+ * @default document
149
+ */
150
+ context?: Context;
100
151
  /**
101
152
  * The character sequence that’s used in various elements, attributes and stylesheets that Accented adds to the page.
153
+ *
154
+ * You shouldn’t have to provide this prop unless some of the names on your page have "accented" in it and conflict with what Accented provides by default.
155
+ *
102
156
  * * The data attribute that’s added to elements with issues (default: `data-accented`).
103
- * * The custom elements for the button and the dialog that get created for each element with issues
157
+ * * The names of custom elements for the button and the dialog that get created for each element with issues
104
158
  * (default: `accented-trigger`, `accented-dialog`).
105
159
  * * The CSS cascade layer containing page-wide Accented-specific styles (default: `accented`).
106
160
  * * The prefix for some of the CSS custom properties used by Accented (default: `--accented-`).
@@ -110,23 +164,25 @@ export type AccentedOptions = {
110
164
  * Only lowercase alphanumeric characters and dashes (-) are allowed in the name,
111
165
  * and it must start with a lowercase letter.
112
166
  *
113
- * Default: `accented`.
167
+ * @default 'accented'
168
+ *
169
+ * @example
170
+ *
171
+ * accented({name: 'my-name'});
172
+ *
173
+ * With the above option provided, the attribute set on elements with issues will be `data-my-name`,
174
+ * a custom element will be called `my-name-trigger`, and so on.
175
+ *
114
176
  */
115
177
  name?: string;
116
178
  /**
117
- * Output options object.
179
+ * An object controlling how the results of scans are presented.
118
180
  * */
119
181
  output?: Output;
120
182
  /**
121
- * Scan throttling options object.
183
+ * An object controlling at what moments Accented will run its scans.
122
184
  * */
123
185
  throttle?: Throttle;
124
- /**
125
- * A callback that will be called after each scan.
126
- *
127
- * Default: `() => {}`.
128
- * */
129
- callback?: Callback;
130
186
  };
131
187
  /**
132
188
  * A function that fully disables Accented,
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,MAAM,MAAM,QAAQ,GAAG;IACrB;;;;SAIK;IACL,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;SAMK;IACL,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB;;;;SAIK;IACL,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AA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AE,MAAM,CAAC;IACZ,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,WAAW,GAAG,UAAU,CAAC;IAClC,QAAQ,EAAE,IAAI,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,GAAG;IACtD,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,GAAG;IAC9D,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1C,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;CACtB,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAyDA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,SAAS,CAAU,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAqEA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,SAAS,CAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"deep-merge.d.ts","sourceRoot":"","sources":["../../src/utils/deep-merge.ts"],"names":[],"mappings":"AACA,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAKrC,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS,CAczE"}
1
+ {"version":3,"file":"deep-merge.d.ts","sourceRoot":"","sources":["../../src/utils/deep-merge.ts"],"names":[],"mappings":"AAGA,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAKrC,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS,CAezE"}
@@ -1,9 +1,11 @@
1
+ import { isNode } from './dom-helpers.js';
1
2
  const isObject = (obj) => typeof obj === 'object' && obj !== null && !Array.isArray(obj);
2
3
  export function deepMerge(target, source) {
3
4
  const output = { ...target };
4
5
  for (const key of Object.keys(source)) {
5
6
  if (isObject(source[key])) {
6
- if (isObject(target[key])) {
7
+ // Don't merge DOM nodes.
8
+ if (isObject(target[key]) && !isNode(target[key])) {
7
9
  output[key] = deepMerge(target[key], source[key]);
8
10
  }
9
11
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"deep-merge.js","sourceRoot":"","sources":["../../src/utils/deep-merge.ts"],"names":[],"mappings":"AAGA,MAAM,QAAQ,GAAG,CAAC,GAAY,EAAoB,EAAE,CAClD,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAEjE,MAAM,UAAU,SAAS,CAAC,MAAiB,EAAE,MAAiB;IAC5D,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;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;YACpD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accented",
3
- "version": "0.0.0-20250618181418",
3
+ "version": "0.0.0-20250701143712",
4
4
  "description": "Continuous accessibility testing and issue highlighting for web development",
5
5
  "type": "module",
6
6
  "main": "dist/accented.js",
@@ -16,6 +16,7 @@
16
16
  "keywords": [
17
17
  "accessibility",
18
18
  "a11y",
19
+ "a11y-testing",
19
20
  "axe",
20
21
  "axe-core"
21
22
  ],
@@ -24,7 +25,7 @@
24
25
  "bugs": {
25
26
  "url": "https://github.com/pomerantsev/accented/issues"
26
27
  },
27
- "homepage": "https://github.com/pomerantsev/accented#readme",
28
+ "homepage": "https://www.accented.dev",
28
29
  "dependencies": {
29
30
  "@preact/signals-core": "^1.8.0",
30
31
  "axe-core": "^4.10.3"
package/src/accented.ts CHANGED
@@ -17,11 +17,11 @@ import { validateOptions } from './validate-options.js';
17
17
  export type { AccentedOptions, DisableAccented };
18
18
 
19
19
  /**
20
- * Enables highlighting of elements with accessibility issues.
20
+ * Enables the continuous scanning and highlighting of accessibility issues on the page.
21
21
  *
22
- * @param {AccentedOptions} options - The options object.
22
+ * @param {AccentedOptions} options - The options object (optional).
23
23
  *
24
- * @returns A `disable` function that can be called to stop the scanning and highlighting.
24
+ * @returns A `disable` function that takes no parameters. When called, disables the scanning and highlighting, and cleans up any changes that Accented has made to the page.
25
25
  *
26
26
  * @example
27
27
  * accented();
@@ -36,8 +36,8 @@ export type { AccentedOptions, DisableAccented };
36
36
  * leading: false
37
37
  * },
38
38
  * callback: ({ elementsWithIssues, performance }) => {
39
- * console.log('Elements with issues:', elementsWithIssues);
40
- * console.log('Total blocking time:', performance.totalBlockingTime);
39
+ * console.log('Elements with issues:', elementsWithIssues);
40
+ * console.log('Total blocking time:', performance.totalBlockingTime);
41
41
  * }
42
42
  * });
43
43
  */
@@ -84,8 +84,7 @@ export function accented(options: AccentedOptions = {}): DisableAccented {
84
84
  if (enabled.value) {
85
85
  // Add link to the recipes section of the docs (#56).
86
86
  console.warn(
87
- 'You are trying to run the Accented library more than once. ' +
88
- 'This will likely lead to errors.',
87
+ 'You are trying to run the Accented library more than once, which may lead to errors.',
89
88
  );
90
89
  console.trace();
91
90
  }
package/src/constants.ts CHANGED
@@ -1,3 +1,3 @@
1
- export const accentedUrl = 'https://www.npmjs.com/package/accented';
1
+ export const accentedUrl = 'https://www.accented.dev';
2
2
  export const issuesUrl = 'https://github.com/pomerantsev/accented/issues';
3
3
  export const getAccentedElementNames = (name: string) => [`${name}-trigger`, `${name}-dialog`];
@@ -42,6 +42,8 @@ export const getAccentedTrigger = (name: string) => {
42
42
  #trigger {
43
43
  pointer-events: auto;
44
44
 
45
+ user-select: none;
46
+
45
47
  margin-inline-start: auto;
46
48
  margin-inline-end: 4px;
47
49
  margin-block-start: 4px;
package/src/scanner.ts CHANGED
@@ -40,12 +40,14 @@ export function createScanner(
40
40
  try {
41
41
  result = await axe.run(scanContext, {
42
42
  elementRef: true,
43
- // Although axe-core can perform iframe scanning, I haven't succeeded in it,
44
- // and the docs suggest that the axe-core script should be explicitly included
45
- // in each of the iframed documents anyway.
46
- // It seems preferable to disallow iframe scanning and not report issues in elements within iframes
47
- // in the case that such issues are for some reason reported by axe-core.
48
- // A consumer of Accented can instead scan the iframed document by calling Accented initialization from that document.
43
+ /**
44
+ * Although axe-core can perform iframe scanning, I haven't succeeded in it,
45
+ * and the docs suggest that the axe-core script should be explicitly included
46
+ * in each of the iframed documents anyway.
47
+ * It seems preferable to disallow iframe scanning and not report issues in elements within iframes
48
+ * in the case that such issues are for some reason reported by axe-core.
49
+ * A consumer of Accented can instead scan the iframed document by calling Accented initialization from that document.
50
+ */
49
51
  iframes: false,
50
52
  resultTypes: ['violations'],
51
53
  ...axeOptions,
@@ -79,15 +81,15 @@ export function createScanner(
79
81
  const domUpdateDuration = Math.round(domUpdateMeasure.duration);
80
82
 
81
83
  callback({
84
+ // Assuming that the {include, exclude} shape of the context object will be used less often
85
+ // than other variants, we'll output just the `include` array in case nothing is excluded
86
+ // in the scan.
87
+ scanContext: scanContext.exclude.length > 0 ? scanContext : scanContext.include,
82
88
  elementsWithIssues: elementsWithIssues.value,
83
89
  performance: {
84
90
  totalBlockingTime: scanDuration + domUpdateDuration,
85
91
  scan: scanDuration,
86
92
  domUpdate: domUpdateDuration,
87
- // Assuming that the {include, exclude} shape of the context object will be used less often
88
- // than other variants, we'll output just the `include` array in case nothing is excluded
89
- // in the scan.
90
- scanContext: scanContext.exclude.length > 0 ? scanContext : scanContext.include,
91
93
  },
92
94
  });
93
95
  } catch (error) {
package/src/types.ts CHANGED
@@ -4,27 +4,39 @@ import type { AccentedTrigger } from './elements/accented-trigger.ts';
4
4
 
5
5
  export type Throttle = {
6
6
  /**
7
- * The minimal time between scans.
7
+ * How long Accented must wait (in milliseconds) to run a scan after a mutation or after the previous scan (whichever finished last).
8
8
  *
9
- * Default: `1000`.
9
+ * If the page you’re scanning has a lot of nodes,
10
+ * scanning may take a noticeable time (~ a few hundred milliseconds),
11
+ * during which time the main thread will be blocked most of the time.
12
+ *
13
+ * You may want to experiment with this value if your page contents change frequently
14
+ * or if it has JavaScript-based animations running on the main thread.
15
+ *
16
+ * @default 1000
10
17
  * */
11
18
  wait?: number;
12
19
 
13
20
  /**
14
- * When to run the scan on Accented initialization or on a mutation.
21
+ * If `leading` is set to `true`, the scan runs immediately after a mutation.
22
+ * In this case, `wait` only applies to subsequent scans,
23
+ * giving the page at least `wait` milliseconds between the end of the previous scan
24
+ * and the beginning of the next one.
15
25
  *
16
- * If `true`, the scan will run immediately. If `false`, the scan will run after the first throttle delay.
26
+ * If `leading` is set to `false`, the wait applies to mutations as well,
27
+ * delaying the output.
28
+ * This may be useful if you’re expecting quick bursts of mutations on your page.
17
29
  *
18
- * Default: `true`.
30
+ * @default true
19
31
  * */
20
32
  leading?: boolean;
21
33
  };
22
34
 
23
35
  export type Output = {
24
36
  /**
25
- * Whether to output the issues to the console.
37
+ * Whether the list of elements with issues should be printed to the browser console whenever issues are added, removed, or changed.
26
38
  *
27
- * Default: `true`.
39
+ * @default true
28
40
  * */
29
41
  console?: boolean;
30
42
  };
@@ -61,48 +73,33 @@ export type AxeOptions = Pick<axe.RunOptions, (typeof allowedAxeOptions)[number]
61
73
 
62
74
  type CallbackParams = {
63
75
  /**
64
- * The most current array of elements with issues.
76
+ * The most up-to-date array of all elements with accessibility issues.
65
77
  * */
66
78
  elementsWithIssues: Array<ElementWithIssues>;
67
79
 
68
80
  /**
69
- * * `performance`: runtime performance of the last scan. An object:
70
- * * `totalBlockingTime`: how long the main thread was blocked by Accented during the last scan, in milliseconds.
81
+ * Runtime performance of the last scan. An object with the following props:
82
+ * - `totalBlockingTime`: how long the main thread was blocked by Accented during the last scan, in milliseconds.
71
83
  * It’s further divided into the `scan` and `domUpdate` phases.
72
- * * `scan`: how long the `scan` phase took, in milliseconds.
73
- * * `domUpdate`: how long the `domUpdate` phase took, in milliseconds.
74
- * * `scanContext`: nodes that got scanned. Either an array of nodes,
75
- * or an object with `include` and `exclude` properties (if any nodes were excluded).
84
+ * - `scan`: how long scanning (the execution of `axe.run()`) took, in milliseconds.
85
+ * - `domUpdate`: how long the DOM update (adding / removing outlines and dialog trigger buttons) took, in milliseconds.
76
86
  * */
77
87
  performance: {
78
88
  totalBlockingTime: number;
79
89
  scan: number;
80
90
  domUpdate: number;
81
- scanContext: ScanContext | Array<Node>;
82
91
  };
92
+
93
+ /**
94
+ * Nodes that got scanned. Either an array of nodes,
95
+ * or an object with `include` and `exclude` properties (if any nodes were excluded).
96
+ */
97
+ scanContext: ScanContext | Array<Node>;
83
98
  };
84
99
 
85
100
  export type Callback = (params: CallbackParams) => void;
86
101
 
87
102
  export type AccentedOptions = {
88
- /**
89
- * The `context` parameter for `axe.run()`.
90
- *
91
- * Determines what element(s) to scan for accessibility issues.
92
- *
93
- * Accepts a variety of shapes:
94
- * * an element reference;
95
- * * a selector;
96
- * * a `NodeList`;
97
- * * an include / exclude object;
98
- * * and more.
99
- *
100
- * See documentation: https://www.deque.com/axe/core-documentation/api-documentation/#context-parameter
101
- *
102
- * Default: `document`.
103
- */
104
- context?: Context;
105
-
106
103
  /**
107
104
  * The `options` parameter for `axe.run()`.
108
105
  *
@@ -115,14 +112,73 @@ export type AccentedOptions = {
115
112
  *
116
113
  * See documentation: https://www.deque.com/axe/core-documentation/api-documentation/#options-parameter
117
114
  *
118
- * Default: `{}`.
115
+ * @default {}
119
116
  */
120
117
  axeOptions?: AxeOptions;
121
118
 
119
+ /**
120
+ * A function that will be called after each scan.
121
+ *
122
+ * Potential uses:
123
+
124
+ * - do something with the scan results,
125
+ * for example send them to a backend for storage and analysis;
126
+ * - analyze Accented’s performance.
127
+ *
128
+ * @default () => {}
129
+ *
130
+ * @example
131
+ *
132
+ * accented({
133
+ * callback: ({ elementsWithIssues, performance, scanContext }) => {
134
+ * console.log('Elements with issues:', elementsWithIssues);
135
+ * console.log('Total blocking time:', performance.totalBlockingTime);
136
+ * console.log('Scan context:', scanContext);
137
+ * }
138
+ * });
139
+ *
140
+ * */
141
+ callback?: Callback;
142
+
143
+ /**
144
+ * The `context` parameter for `axe.run()`.
145
+ *
146
+ * Determines what part(s) of the page to scan for accessibility issues.
147
+ *
148
+ * Accepts a variety of shapes:
149
+ *
150
+ * - a [`Node`](https://developer.mozilla.org/en-US/docs/Web/API/Node) (in practice it will likely be an instance of [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element), [`Document`](https://developer.mozilla.org/en-US/docs/Web/API/Document), or [`DocumentFragment`](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment));
151
+ * - a valid [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_selectors);
152
+ * - an object for selecting elements within shadow DOM,
153
+ * whose shape is `{ fromShadowDom: [selector1, selector2, ...] }`,
154
+ * where `selector1`, `selector2`, etc. select shadow hosts, and the last selector selects the actual context.
155
+ * `selector2` in this example is _within_ the shadow root created on the element(s) that match `selector1`,
156
+ * so in practice you shouldn’t have more than two elements in such an array
157
+ * unless you have a very complex structure with multiple shadow DOM layers;
158
+ * - a [`NodeList`](https://developer.mozilla.org/en-US/docs/Web/API/NodeList) (likely a result of a [`querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) call);
159
+ * - an array containing any combination of selectors, nodes, or shadow DOM objects (described above);
160
+ * - an object containing `include` and / or `exclude` properties.
161
+ * It’s useful if you’d like to exclude certain elements or parts of the page.
162
+ * The values for `include` and `exclude` can take any of the above shapes.
163
+ * It’s unlikely that you’d want to have complex `include` / `exclude` rules,
164
+ * but if you do, the exact behavior is documented by the relevant tests:
165
+ * [`is-node-in-scan-context.test.ts`](https://github.com/pomerantsev/accented/blob/main/packages/accented/src/utils/is-node-in-scan-context.test.ts).
166
+ *
167
+ * See also the documentation for the [`context` parameter of `axe.run()`](https://www.deque.com/axe/core-documentation/api-documentation/#context-parameter),
168
+ * which the `context` option from Accented mostly mirrors
169
+ * (note that Accented doesn’t support the `fromFrames` object shape).
170
+ *
171
+ * @default document
172
+ */
173
+ context?: Context;
174
+
122
175
  /**
123
176
  * The character sequence that’s used in various elements, attributes and stylesheets that Accented adds to the page.
177
+ *
178
+ * You shouldn’t have to provide this prop unless some of the names on your page have "accented" in it and conflict with what Accented provides by default.
179
+ *
124
180
  * * The data attribute that’s added to elements with issues (default: `data-accented`).
125
- * * The custom elements for the button and the dialog that get created for each element with issues
181
+ * * The names of custom elements for the button and the dialog that get created for each element with issues
126
182
  * (default: `accented-trigger`, `accented-dialog`).
127
183
  * * The CSS cascade layer containing page-wide Accented-specific styles (default: `accented`).
128
184
  * * The prefix for some of the CSS custom properties used by Accented (default: `--accented-`).
@@ -132,26 +188,27 @@ export type AccentedOptions = {
132
188
  * Only lowercase alphanumeric characters and dashes (-) are allowed in the name,
133
189
  * and it must start with a lowercase letter.
134
190
  *
135
- * Default: `accented`.
191
+ * @default 'accented'
192
+ *
193
+ * @example
194
+ *
195
+ * accented({name: 'my-name'});
196
+ *
197
+ * With the above option provided, the attribute set on elements with issues will be `data-my-name`,
198
+ * a custom element will be called `my-name-trigger`, and so on.
199
+ *
136
200
  */
137
201
  name?: string;
138
202
 
139
203
  /**
140
- * Output options object.
204
+ * An object controlling how the results of scans are presented.
141
205
  * */
142
206
  output?: Output;
143
207
 
144
208
  /**
145
- * Scan throttling options object.
209
+ * An object controlling at what moments Accented will run its scans.
146
210
  * */
147
211
  throttle?: Throttle;
148
-
149
- /**
150
- * A callback that will be called after each scan.
151
- *
152
- * Default: `() => {}`.
153
- * */
154
- callback?: Callback;
155
212
  };
156
213
 
157
214
  /**
@@ -1,3 +1,5 @@
1
+ import { isNode } from './dom-helpers.js';
2
+
1
3
  // biome-ignore lint/suspicious/noExplicitAny: I'm not sure how to type this properly
2
4
  type AnyObject = Record<string, any>;
3
5
 
@@ -8,7 +10,8 @@ export function deepMerge(target: AnyObject, source: AnyObject): AnyObject {
8
10
  const output = { ...target };
9
11
  for (const key of Object.keys(source)) {
10
12
  if (isObject(source[key])) {
11
- if (isObject(target[key])) {
13
+ // Don't merge DOM nodes.
14
+ if (isObject(target[key]) && !isNode(target[key])) {
12
15
  output[key] = deepMerge(target[key], source[key]);
13
16
  } else {
14
17
  output[key] = source[key];