Skip to content

Commit a90065c

Browse files
authored
Vendor axe-core, drop the Skypack CDN dependency (#14677)
* Vendor axe-core 4.10.3 as a bundled HTML resource Pins AXE_JS in configuration and adds a download block to update-html-dependencies.ts (axe.min.js plus the MPL-2.0 LICENSE and LICENSE-3RD-PARTY.txt, which must ship alongside it). Files are vendored byte-for-byte from npm via unpkg; the /*! banner in axe.min.js carries the required Deque copyright and MPL notice. * Load vendored axe-core instead of the Skypack CDN Injects axe.min.js as a classic script ahead of axe-check.js (a deferred module), so window.axe is set before the checker runs. Replaces the pinned Skypack dynamic import, making the axe overlay work offline and removing the CDN request from every reader's browser. Same axe version (4.10.3), identical scan results. Also waits for the window load event before the first scan. Deferred modules run before DOMContentLoaded, but the dashboard layout runs on DOMContentLoaded and keeps <html> hidden until then, so an immediate scan sees only hidden elements and reports nothing. The Skypack import's network latency masked this pre-existing race; removing it exposed the bug (8 dashboard Playwright tests).
1 parent bf9160a commit a90065c

8 files changed

Lines changed: 464 additions & 1 deletion

File tree

‎configuration‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export BOOTSWATCH=5.3.1
3535

3636
# javascript HTML dependencies
3737
export ANCHOR_JS=5.0.0
38+
export AXE_JS=4.10.3
3839
export POPPER_JS=2.11.7
3940
export CLIPBOARD_JS=2.0.11
4041
export TIPPY_JS=6.3.7

‎news/changelog-1.10.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ All changes included in 1.10:
1111
## Dependencies
1212

1313
- ([#14291](https://github.com/quarto-dev/quarto-cli/issues/14291)): Update `deno` to v2.7.14 (fixes silent crash on Windows builds older than 16299).
14+
- ([#14677](https://github.com/quarto-dev/quarto-cli/pull/14677)): Bundle `axe-core` 4.10.3 (used by the `axe` HTML accessibility option), previously loaded at runtime from the Skypack CDN.
1415

1516
## Accessibility
1617

1718
- ([#14468](https://github.com/quarto-dev/quarto-cli/issues/14468)): The `axe` accessibility report UI (HTML overlay, revealjs report slide, dashboard offcanvas) now uses its own theme-independent colors instead of inheriting from `brand` or theme. Keeps the report readable regardless of page styling, and stops `axe` from clobbering brand colors set via `_brand.yml`.
1819
- ([#14602](https://github.com/quarto-dev/quarto-cli/pull/14602), [#14632](https://github.com/quarto-dev/quarto-cli/pull/14632)): Fix ORCID profile link having no accessible name for screen readers in HTML, Reveal.js, and ipynb title-block author metadata. (author: @mcanouil for #14602)
1920
- ([#14604](https://github.com/quarto-dev/quarto-cli/issues/14604)): The `axe` accessibility report UI now shows each violation's WCAG conformance level (e.g. `WCAG 2.0 AA (1.4.3)`) or `Best Practice`, derived from the violation's axe-core tags.
2021
- ([#14655](https://github.com/quarto-dev/quarto-cli/issues/14655)): Add accessible names to code line-number links so screen readers and accessibility audits no longer report them as empty links.
22+
- ([#14677](https://github.com/quarto-dev/quarto-cli/pull/14677)): The `axe` option now uses a copy of axe-core bundled with Quarto instead of loading it from the Skypack CDN in the reader's browser. Accessibility checking now works offline, and viewing a rendered document no longer triggers a request to `cdn.skypack.dev`. The axe-core version is unchanged (4.10.3), so scan results are identical.
2123

2224
## Formats
2325

‎package/src/common/update-html-dependencies.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ export async function updateHtmlDependencies(config: Configuration) {
7878
);
7979
cleanSourceMap(anchorJs);
8080

81+
// Axe (LICENSE files must ship alongside the MPL-2.0 axe.min.js)
82+
const axeDir = join(formatDir, "axe");
83+
for (const file of ["axe.min.js", "LICENSE", "LICENSE-3RD-PARTY.txt"]) {
84+
await updateUnpkgDependency("AXE_JS", "axe-core", file, join(axeDir, file));
85+
}
86+
8187
// Poppper
8288
const popperJs = join(formatDir, "popper", "popper.min.js");
8389
await updateUnpkgDependency(

‎src/format/html/format-html-axe.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ function axeHtmlDependency(options: unknown): FormatDependency {
2222
encodeBase64(JSON.stringify(options))
2323
}</script>`,
2424
scripts: [{
25+
// Classic script, so it executes before the deferred module below.
26+
name: "axe.min.js",
27+
path: formatResourcePath("html", join("axe", "axe.min.js")),
28+
}, {
2529
name: "axe-check.js",
2630
path: formatResourcePath("html", join("axe", "axe-check.js")),
2731
attribs: { type: "module" },

0 commit comments

Comments
 (0)