Skip to content

test(a11y): wait for the consent banner so axe actually checks it - #405

Merged
Ducksss merged 1 commit into
devfrom
claude/axe-consent-banner-scope
Jul 28, 2026
Merged

Ducksss merged 1 commit into
devfrom
claude/axe-consent-banner-scope

Conversation

@Ducksss

@Ducksss Ducksss commented Jul 28, 2026 •

Copy link
Copy Markdown
Owner

Found while verifying that dev's tip was still green after #394, #398 and #404 all landed via --admin alongside #400, which reshaped the consent banner. The combination is fine — but checking it turned up something else.

The problem

Both axe suites deliberately don't grant consent, so the undecided consent banner is part of what gets checked. templates.e2e.spec.ts even says so: "the axe suites deliberately run without consent so it is still held to the a11y bar."

That was not actually happening. The banner is client-rendered and lands 100–200 ms after document.fonts.ready — which is exactly the point both suites were analysing at. Measured per route:

route banner present at fonts.ready? appears after
/templates no 108 ms
/ no 219 ms
/components no 115 ms
/templates/saas-launch yes 5 ms

So the coverage came down to how warm the server was, and it differed between routes in the same run. On a warm route the banner was checked; on a cold one it wasn't. Worst of both: not covered, and not consistently uncovered either.

The fix

Both suites now wait for [data-consent-banner] — the hook consent.e2e.spec.ts already uses — before analysing.

The wait doubles as an assertion that the banner is on those routes at all, and it passes on every route in both suites. That is what makes the documented scope real rather than incidental. Template preview routes are exempt because AnalyticsShell returns null there, an exemption templates.e2e.spec.ts already pins.

What it found

Nothing — no violations surfaced once the banner was reliably in scope, including against the per-provider banner #400 introduced. That is the good outcome, and it is now a checked fact instead of a coin toss.

Verification

pnpm test:release green — batches 44 / 69 / 102 / 43 / 133, int 379 passed. I also ran dev's tip unmodified beforehand to confirm the three recently-merged PRs and #400 don't conflict: also green.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Improved accessibility test coverage by verifying that the consent banner appears across tested routes.
    • Reduced accessibility scan flakiness on gallery and template detail pages by waiting for client-rendered content to settle before analysis.
    • Expanded test documentation around accessibility validation and timing requirements.

Both axe suites deliberately skip granting consent so the undecided consent
banner — sitewide chrome — is held to the same accessibility bar. That only
works if axe waits for it, and it wasn't: the banner is client-rendered and
lands 100-200ms AFTER document.fonts.ready, which is the point both suites
analysed at. Measured per route, it was absent at fonts.ready on /, /components
and /templates, and present on a warm /templates/<slug> — so the coverage the
comments claimed was really down to how warm the server was, and inconsistent
between routes in the same run.

Both suites now wait for [data-consent-banner] (the hook consent.e2e.spec.ts
already uses) before analysing. The wait doubles as an assertion that the
banner is on those routes at all; it passes on every route in both suites,
which is what makes the stated scope real rather than incidental. The template
preview routes are exempt because AnalyticsShell returns null there, an
exemption templates.e2e.spec.ts already pins.

No violations surfaced once the banner was reliably in scope, including against
the per-provider banner #400 reshaped — but that is now a checked fact rather
than a coin toss.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 28, 2026 11:36
@vercel

vercel Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
payload-components Ready Ready Preview, Comment Jul 28, 2026 11:40am
payload-components-97bf Ready Ready Preview, Comment Jul 28, 2026 11:40am

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: da7ccab1-89a2-407d-b134-cb5fd13095b4

📥 Commits

Reviewing files that changed from the base of the PR and between 0cab419 and 0f8b1c5.

📒 Files selected for processing (2)
  • tests/e2e/a11y.e2e.spec.ts
  • tests/e2e/templates-a11y.e2e.spec.ts

📝 Walkthrough

Walkthrough

E2E accessibility suites now wait for the client-rendered consent banner before running axe analysis. The template suite adds optional banner waiting to its settling helper and enables it for gallery and detail routes.

Changes

Consent banner accessibility gating

Layer / File(s) Summary
Sitewide axe gating
tests/e2e/a11y.e2e.spec.ts
Defines the consent-banner selector and verifies its visibility before font settling and axe analysis.
Template sweep settling
tests/e2e/templates-a11y.e2e.spec.ts
Adds optional consent-banner waiting to settle and enables it for gallery and template detail tests.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is substantive but does not follow the required template and is missing the Summary, Verification checkbox, Registry Checklist, and Notes sections. Rewrite it using the template headings, add the verification checkbox, complete the registry checklist, and include a brief Notes section.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main change: waiting for the consent banner before Axe runs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/axe-consent-banner-scope

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Ducksss
Ducksss merged commit 5329f70 into dev Jul 28, 2026
12 checks passed
@Ducksss
Ducksss deleted the claude/axe-consent-banner-scope branch July 29, 2026 07:33
Ducksss added a commit that referenced this pull request Jul 29, 2026
…r adoption, template a11y (#409)

Brings main level with dev (137 commits). Headline items:

- the component wall no longer crops blocks: per-breakpoint zoom pins the twins'
  inner layout width at 1280px (#392), and the 640-1023px band gets a 256px frame
  plus a widened fade (#399). Production was cutting content-quote,
  content-feature-media and content-feature-split by 88/79/78px on a tablet;
  measured on the live site, not inferred. Three viewport tests now assert the fit
  so a curated-at-one-width regression cannot recur silently.
- prettier is adopted: config matched to the house style (#402), the tree
  formatted, and format:check gated in test:release and the CI lint step (#408).
- template a11y and layout fixes (#394, #398, #404), consent gate split by
  provider (#400), axe now waits for the consent banner (#405), CodeQL
  double-escaping fix (#391).

Tree is identical to dev by construction: branched from dev, reparented onto main,
so the diff is exactly the main..dev delta with no squash-divergence conflicts.

This branch was successfully deployed

2 active deployments
Preview – payload-components — 0f8b1c51 Deployed Jul 28, 2026 by vercel[bot]
Preview – payload-components-97bf — 0f8b1c51 Deployed Jul 28, 2026 by vercel[bot]
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.

2 participants