@accesslint/core 0.6.3 → 0.6.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/LICENSE +21 -0
- package/README.md +130 -75
- package/dist/index.cjs +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.js +8 -5
- package/dist/rules/structure/list-rules.d.ts.map +1 -1
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AccessLint
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
# @accesslint/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@accesslint/core)
|
|
4
|
+
[](https://github.com/AccessLint/core/blob/main/LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Pure accessibility rule engine for WCAG auditing. 93 bundled rules (92 active by default) and zero browser dependencies.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
> Automated testing catches a meaningful subset of accessibility issues, but not all of them. You'll still need to test with assistive technologies and include people with disabilities in user research.
|
|
9
|
+
|
|
10
|
+
## Contents
|
|
11
|
+
|
|
12
|
+
- [Why @accesslint/core](#why-accesslintcore)
|
|
13
|
+
- [Install](#install)
|
|
14
|
+
- [Quick start](#quick-start)
|
|
15
|
+
- [API](#api)
|
|
16
|
+
- [Rules](#rules)
|
|
17
|
+
- [Compatibility](#compatibility)
|
|
18
|
+
- [Development](#development)
|
|
19
|
+
|
|
20
|
+
## Why @accesslint/core
|
|
21
|
+
|
|
22
|
+
- **Synchronous API** — `runAudit()` returns results immediately, no async/await needed
|
|
23
|
+
- **Works with happy-dom** — full support for happy-dom, jsdom, and real browsers with no polyfills or workarounds, including color contrast checks in virtual DOMs
|
|
24
|
+
- **Lightweight** — 43 KB gzipped (IIFE), zero runtime dependencies
|
|
8
25
|
- **Chunked audits** — time-budgeted processing via [`createChunkedAudit`](#createchunkedauditdoc-document-chunkedaudit) to avoid long tasks on the main thread
|
|
9
26
|
- **ESM, CJS, and IIFE** — tree-shakable ES modules, CommonJS for Node, and a single-file IIFE for script injection into any page
|
|
10
|
-
- **Runs anywhere** — works with happy-dom, jsdom, and real browsers with no DOM polyfills or compatibility workarounds. Run accessibility audits in Vitest and React Testing Library using the same environment as the rest of your tests
|
|
11
27
|
- **MIT licensed**
|
|
12
28
|
|
|
13
29
|
## Install
|
|
@@ -175,89 +191,128 @@ Helpers for building custom rules:
|
|
|
175
191
|
|
|
176
192
|
## Rules
|
|
177
193
|
|
|
178
|
-
|
|
194
|
+
92 rules active by default, covering WCAG 2.1 Level A and AA. One additional AAA-level rule (`color-contrast-enhanced`) is bundled but excluded by default; include it via `configureRules({ includeAAA: true })`.
|
|
179
195
|
|
|
180
196
|
| Rule | Level | WCAG | Description |
|
|
181
197
|
| ---- | ----- | ---- | ----------- |
|
|
182
|
-
| `
|
|
183
|
-
| `
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
190
|
-
| `
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
201
|
-
| `
|
|
202
|
-
| `
|
|
203
|
-
| `
|
|
204
|
-
| `
|
|
205
|
-
| `
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
215
|
-
| `
|
|
216
|
-
| `
|
|
217
|
-
| `
|
|
218
|
-
| `
|
|
219
|
-
| `
|
|
220
|
-
| `
|
|
221
|
-
| `
|
|
222
|
-
| `
|
|
223
|
-
| `
|
|
224
|
-
| `
|
|
225
|
-
| `
|
|
226
|
-
| `
|
|
227
|
-
| `
|
|
228
|
-
| `
|
|
229
|
-
| `
|
|
230
|
-
| `
|
|
231
|
-
| `
|
|
232
|
-
| `
|
|
233
|
-
| `
|
|
234
|
-
| `
|
|
235
|
-
| `
|
|
236
|
-
| `
|
|
237
|
-
| `
|
|
238
|
-
| `
|
|
239
|
-
| `
|
|
240
|
-
| `
|
|
241
|
-
| `
|
|
242
|
-
| `
|
|
243
|
-
| `
|
|
244
|
-
| `
|
|
245
|
-
| `
|
|
246
|
-
| `
|
|
247
|
-
| `
|
|
248
|
-
| `
|
|
249
|
-
| `
|
|
250
|
-
| `
|
|
198
|
+
| `accesslint-001` | A | 2.4.2 | Documents must have a `<title>` element. |
|
|
199
|
+
| `accesslint-002` | A | — | Page must have a mechanism to bypass repeated blocks. |
|
|
200
|
+
| `accesslint-003` | A | — | Page should contain a level-one heading. |
|
|
201
|
+
| `accesslint-004` | A | 4.1.2 | Frames must have an accessible name. |
|
|
202
|
+
| `accesslint-005` | A | 4.1.2 | Frame titles should be unique. |
|
|
203
|
+
| `accesslint-006` | AA | 1.4.4 | Viewport meta must not disable user scaling. |
|
|
204
|
+
| `accesslint-007` | A | 2.2.1 | Meta refresh must not redirect or refresh automatically. |
|
|
205
|
+
| `accesslint-008` | A | 2.2.1 | Meta refresh must not be used with a delay (no exceptions). |
|
|
206
|
+
| `accesslint-009` | A | 2.2.2 | `<blink>` must not be used. |
|
|
207
|
+
| `accesslint-010` | A | 2.2.2 | `<marquee>` must not be used. |
|
|
208
|
+
| `accesslint-011` | A | 1.1.1 | Images must have alternate text. |
|
|
209
|
+
| `accesslint-012` | A | 1.1.1 | SVG images must have an accessible name. |
|
|
210
|
+
| `accesslint-013` | A | 1.1.1, 4.1.2 | Image inputs must have alternate text. |
|
|
211
|
+
| `accesslint-014` | A | — | Image alt should not duplicate adjacent text. |
|
|
212
|
+
| `accesslint-015` | A | — | Alt text should not contain "image", "photo", etc. |
|
|
213
|
+
| `accesslint-016` | A | 1.1.1, 4.1.2 | `<area>` elements must have alt text. |
|
|
214
|
+
| `accesslint-017` | A | 1.1.1 | `<object>` elements must have alt text. |
|
|
215
|
+
| `accesslint-018` | A | 1.1.1 | `role="img"` elements must have an accessible name. |
|
|
216
|
+
| `accesslint-019` | A | 2.1.1 | Server-side image maps must not be used. |
|
|
217
|
+
| `accesslint-020` | A | 4.1.2 | Form elements must have labels. |
|
|
218
|
+
| `accesslint-021` | A | — | Form fields should not have multiple labels. |
|
|
219
|
+
| `accesslint-022` | A | 4.1.2 | Select elements must have a label. |
|
|
220
|
+
| `accesslint-023` | A | 4.1.2 | Input buttons must have discernible text. |
|
|
221
|
+
| `accesslint-024` | AA | 1.3.5 | Autocomplete attribute must use valid values. |
|
|
222
|
+
| `accesslint-025` | A | — | Accessible name must contain visible text. |
|
|
223
|
+
| `accesslint-026` | A | — | Forms should not use title as the only label. |
|
|
224
|
+
| `accesslint-027` | A | — | tabindex should not be greater than 0. |
|
|
225
|
+
| `accesslint-028` | A | — | Focusable elements must have an appropriate role. |
|
|
226
|
+
| `accesslint-029` | A | 4.1.2 | Interactive controls must not be nested. |
|
|
227
|
+
| `accesslint-030` | A | 2.1.1 | Scrollable regions must be keyboard accessible. |
|
|
228
|
+
| `accesslint-031` | A | — | Accesskey values must be unique. |
|
|
229
|
+
| `accesslint-032` | AA | 2.4.7 | Elements in focus order must have a visible focus indicator. |
|
|
230
|
+
| `accesslint-033` | A | — | Heading levels should increase by one. |
|
|
231
|
+
| `accesslint-034` | A | — | Headings must have discernible text. |
|
|
232
|
+
| `accesslint-035` | A | — | Paragraphs should not be styled as headings. |
|
|
233
|
+
| `accesslint-036` | A | — | Page should have one main landmark. |
|
|
234
|
+
| `accesslint-037` | A | — | No duplicate banner landmarks. |
|
|
235
|
+
| `accesslint-038` | A | — | No duplicate contentinfo landmarks. |
|
|
236
|
+
| `accesslint-039` | A | — | No duplicate main landmarks. |
|
|
237
|
+
| `accesslint-040` | A | — | Banner landmark should be top-level. |
|
|
238
|
+
| `accesslint-041` | A | — | Contentinfo landmark should be top-level. |
|
|
239
|
+
| `accesslint-042` | A | — | Main landmark should be top-level. |
|
|
240
|
+
| `accesslint-043` | A | — | Aside landmark should be top-level. |
|
|
241
|
+
| `accesslint-044` | A | — | Landmarks of the same type should have unique labels. |
|
|
242
|
+
| `accesslint-045` | A | — | All content should be within landmarks. |
|
|
243
|
+
| `accesslint-046` | A | 1.3.1 | `<ul>` and `<ol>` must only contain valid children. |
|
|
244
|
+
| `accesslint-047` | A | 1.3.1 | `<li>` must be in a `<ul>`, `<ol>`, or `<menu>`. |
|
|
245
|
+
| `accesslint-048` | A | 1.3.1 | `<dt>` and `<dd>` must be in a `<dl>`. |
|
|
246
|
+
| `accesslint-049` | A | 1.3.1 | `<dl>` must only contain valid children. |
|
|
247
|
+
| `accesslint-050` | AA | 1.4.12 | Letter spacing with `!important` must be at least 0.12em. |
|
|
248
|
+
| `accesslint-051` | AA | 1.4.12 | Line height with `!important` must be at least 1.5. |
|
|
249
|
+
| `accesslint-052` | AA | 1.4.12 | Word spacing with `!important` must be at least 0.16em. |
|
|
250
|
+
| `accesslint-053` | AA | 1.3.4 | Page orientation must not be restricted. |
|
|
251
|
+
| `accesslint-054` | A | 4.1.2 | ARIA role values must be valid. |
|
|
252
|
+
| `accesslint-055` | A | 4.1.2 | ARIA attributes must be valid (correctly spelled). |
|
|
253
|
+
| `accesslint-056` | A | 4.1.2 | ARIA attributes must have valid values. |
|
|
254
|
+
| `accesslint-057` | A | 4.1.2 | Required ARIA attributes must be present. |
|
|
255
|
+
| `accesslint-058` | A | 4.1.2 | ARIA attributes must be allowed for the role. |
|
|
256
|
+
| `accesslint-059` | A | 4.1.2 | ARIA role must be appropriate for the element. |
|
|
257
|
+
| `accesslint-060` | A | 1.3.1 | ARIA roles must have required child roles. |
|
|
258
|
+
| `accesslint-061` | A | 1.3.1 | ARIA roles must be in required parent roles. |
|
|
259
|
+
| `accesslint-062` | A | 4.1.2 | `aria-hidden` must not be on `<body>`. |
|
|
260
|
+
| `accesslint-063` | A | 4.1.2 | `aria-hidden` regions must not contain focusable elements. |
|
|
261
|
+
| `accesslint-064` | A | 4.1.2 | ARIA commands must have an accessible name. |
|
|
262
|
+
| `accesslint-065` | A | 4.1.2 | ARIA input fields must have an accessible name. |
|
|
263
|
+
| `accesslint-066` | A | 4.1.2 | ARIA toggle fields must have an accessible name. |
|
|
264
|
+
| `accesslint-067` | A | 4.1.2 | ARIA meters must have an accessible name. |
|
|
265
|
+
| `accesslint-068` | A | 4.1.2 | ARIA progressbars must have an accessible name. |
|
|
266
|
+
| `accesslint-069` | A | 4.1.2 | ARIA dialogs must have an accessible name. |
|
|
267
|
+
| `accesslint-070` | A | 4.1.2 | ARIA tooltips must have an accessible name. |
|
|
268
|
+
| `accesslint-071` | A | 4.1.2 | ARIA treeitems must have an accessible name. |
|
|
269
|
+
| `accesslint-072` | A | 4.1.2 | ARIA attributes must not be prohibited for the role. |
|
|
270
|
+
| `accesslint-073` | A | 4.1.2 | Presentation role must not conflict with focusability. |
|
|
271
|
+
| `accesslint-074` | A | 4.1.2 | Presentational children must not contain focusable content. |
|
|
272
|
+
| `accesslint-075` | A | 4.1.2 | Buttons must have discernible text. |
|
|
273
|
+
| `accesslint-076` | A | 4.1.2 | `<summary>` elements must have an accessible name. |
|
|
274
|
+
| `accesslint-077` | A | 2.4.4, 4.1.2 | Links must have discernible text. |
|
|
275
|
+
| `accesslint-078` | A | 2.4.1 | Skip links must point to a valid target. |
|
|
276
|
+
| `accesslint-079` | A | 1.4.1 | Links in text blocks must be distinguishable by more than color. |
|
|
277
|
+
| `accesslint-080` | A | 3.1.1 | `<html>` must have a `lang` attribute. |
|
|
278
|
+
| `accesslint-081` | A | 3.1.1 | `lang` on `<html>` must be valid. |
|
|
279
|
+
| `accesslint-082` | AA | 3.1.2 | `lang` attribute must have a valid value on all elements. |
|
|
280
|
+
| `accesslint-083` | A | 3.1.1 | `lang` and `xml:lang` must match. |
|
|
281
|
+
| `accesslint-084` | A | 1.3.1 | Table headers references must be valid. |
|
|
282
|
+
| `accesslint-085` | A | 1.3.1 | Table headers should be associated with data cells. |
|
|
283
|
+
| `accesslint-086` | A | 1.3.1 | Data cells in large tables should have associated headers. |
|
|
284
|
+
| `accesslint-087` | A | 1.3.1 | `scope` attribute must have a valid value. |
|
|
285
|
+
| `accesslint-088` | A | — | Table headers should have visible text. |
|
|
286
|
+
| `accesslint-089` | A | 4.1.2 | IDs used in ARIA must be unique. |
|
|
287
|
+
| `accesslint-090` | A | 1.2.2 | Videos must have captions. |
|
|
288
|
+
| `accesslint-091` | A | 1.2.1 | Audio elements should have a text alternative. |
|
|
289
|
+
| `accesslint-092` | AA | 1.4.3 | Text must have sufficient color contrast. |
|
|
290
|
+
| `accesslint-093` | AAA | 1.4.6 | Text must have enhanced color contrast (AAA). |
|
|
291
|
+
|
|
292
|
+
## Compatibility
|
|
293
|
+
|
|
294
|
+
Tested in the following environments:
|
|
295
|
+
|
|
296
|
+
| Environment | Support |
|
|
297
|
+
| ----------- | ------- |
|
|
298
|
+
| Node.js 18+ | Yes |
|
|
299
|
+
| happy-dom | Yes |
|
|
300
|
+
| jsdom | Yes |
|
|
301
|
+
| Chrome / Edge | Yes |
|
|
302
|
+
| Firefox | Yes |
|
|
303
|
+
| Safari | Yes |
|
|
251
304
|
|
|
252
305
|
## Development
|
|
253
306
|
|
|
254
307
|
```sh
|
|
255
308
|
npm install
|
|
256
|
-
npm test #
|
|
309
|
+
npm test # 1030 tests
|
|
257
310
|
npm run bench # performance benchmarks
|
|
258
311
|
npm run build # produces dist/index.js, dist/index.cjs, dist/index.d.ts
|
|
259
312
|
```
|
|
260
313
|
|
|
314
|
+
Found a bug or have a suggestion? [Open an issue](https://github.com/AccessLint/core/issues).
|
|
315
|
+
|
|
261
316
|
## License
|
|
262
317
|
|
|
263
318
|
MIT
|