Skip to content

fix(CookieConsent): a dismissed banner leaves the accessibility tree, and its title is not a heading - #30

Merged
thinkclay merged 1 commit into
mainfrom
fix/cookie-banner-a11y
Sep 17, 2026
Merged

thinkclay merged 1 commit into
mainfrom
fix/cookie-banner-a11y

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

What

CookieConsentBanner hid itself with opacity: 0. That kept three focusable buttons and an <h6> in the accessibility tree and tab order on every page after consent, and the <h6> broke heading order on any page with an <h1>/<h2> — Lighthouse's heading-order audit on scaffald.com's / and /contact (Scaffald/SaaS#774). It was also why 'did the banner hide?' DOM probes kept answering no (Scaffald/SaaS#452).

  • Hidden is now display: none + aria-hidden. Still rendered unconditionally, so the server and the client's first render agree (the provider's hydration note stands).
  • The title is bold Text inside a role="region" labelled 'Cookie consent', not a Heading.
  • testID="cookie-consent-banner" on the container, for probes.

Verification

3 new tests (react-dom render): hidden until the storage read resolves then shown; stays hidden when consent exists; no heading role, region present. Typecheck and biome clean. Lighthouse heading-order on the consumer's landing and contact pages goes from failing to passing in the Scaffald/SaaS PR that bumps the pointer.

🤖 Generated with Claude Code

… and its title is not a heading

Hidden meant opacity: 0, which kept three focusable buttons and an <h6> in
every page's accessibility tree after consent, and made the <h6> break heading
order on pages with an <h1>/<h2> (Lighthouse heading-order). Hidden is now
display: none + aria-hidden; the title is bold text inside a labelled region.
Rendered unconditionally as before, so server and first client render agree.

Scaffald/SaaS#774, Scaffald/SaaS#452

Co-Authored-By: Claude Fable 5.1 <[email protected]>
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.

1 participant