Skip to content

fix(html/axe): use literal overlay colors to avoid clobbering brand#14471

Merged
cscheid merged 5 commits into
mainfrom
fix-axe-clobbers-brand-14468
May 1, 2026
Merged

fix(html/axe): use literal overlay colors to avoid clobbering brand#14471
cscheid merged 5 commits into
mainfrom
fix-axe-clobbers-brand-14468

Conversation

@cwickham
Copy link
Copy Markdown
Member

@cwickham cwickham commented May 1, 2026

Closes #14468.

Bug

Setting axe: on an HTML format clobbered brand-defined background, foreground, and link.color. The axe sass bundle declared $body-bg, $body-color, and $link-color defaults in its user SassLayer, which precede brand's user defaults during sass compilation, so axe's white/dark/blue defaults won via !default resolution. Affected every output mode (true, console, document) since the bundle is added unconditionally.

Approach

The axe report is developer chrome, not document content — its colors should not depend on (and should not override) the page's brand or theme. The overlay's readability matters most when the page itself has poor contrast, since that's exactly what axe is reporting.

So instead of fighting over $body-* defaults, the overlay rules now use literal hex values scoped to axe selectors. Brand and theme colors win on the page; the overlay always looks like itself. Colors picked to pass WCAG AAA contrast against white (#222 body text = 16:1, #0747a6 links = 8.5:1) — appropriate for a debugging tool meant to surface accessibility issues.

What changed

  • HTML overlay (src/format/html/format-html-axe.ts): replaced $body-bg / $body-color / $link-color references in the axe rules with literal #fff / #222 / #0747a6. Dropped the !default declarations entirely — they're no longer needed.
  • RevealJS report slide: forces data-background-color="#fff" on the appended section (in axe-check.js) so reveal paints the slide white via its own .slide-background mechanism. Slide-scoped color: #222 keeps text readable.
  • Dashboard report offcanvas: overrides --bs-offcanvas-bg and --bs-offcanvas-color for .quarto-axe-offcanvas so the panel ignores Bootstrap/brand offcanvas theming.

Tests

Four new smoke-all tests under tests/docs/smoke-all/2026/05/01/:

  • issue-14468-axe-brand.qmd — HTML + axe + brand: brand wins on body, axe overlay keeps #fff fallback.
  • issue-14468-axe-revealjs.qmd — revealjs + axe + brand: report slide rule has color: #222; no \$body-* SCSS leakage.
  • issue-14468-axe-dashboard.qmd — dashboard + axe + brand: offcanvas has --bs-offcanvas-bg: #fff.
  • issue-14468-axe-no-brand.qmd — HTML + axe, no brand: Bootstrap defaults still apply (regression guard).

All 9 existing axe tests in tests/docs/smoke-all/accessibility/ continue to pass.

…r brand (#14468)

The axe report's sass bundle declared `$body-bg`, `$body-color`, and
`$link-color` defaults in its user SassLayer, which precede brand's user
defaults during sass compilation and so clobbered brand colors on the
page. Since the axe report is developer chrome (not document content),
its overlay rules now use literal hex values instead of theme-derived
SCSS variables. Brand and theme colors win on the page; the overlay
stays readable regardless of how the page is themed.

Same treatment applied to the revealjs report slide (force #fff slide
background via data-background-color and #222 text) and the dashboard
report offcanvas (override --bs-offcanvas-bg/-color to axe defaults).
@posit-snyk-bot
Copy link
Copy Markdown
Collaborator

posit-snyk-bot commented May 1, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cwickham cwickham requested a review from cscheid May 1, 2026 18:54
Copy link
Copy Markdown
Member

@cscheid cscheid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks good! We'll fire off a new prerelease build for you right away.

@cscheid cscheid merged commit 647bce4 into main May 1, 2026
127 of 136 checks passed
@cscheid cscheid deleted the fix-axe-clobbers-brand-14468 branch May 1, 2026 20:55
@cderv
Copy link
Copy Markdown
Member

cderv commented May 4, 2026

Thank you, looks good! We'll fire off a new prerelease build for you right away.

Reminder: We can't until we sort our properly Mac signing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enabling axe clobbers brand background

4 participants