Skip to content

Fix Cookie Notice policy link accessibility (WCAG 2.4.4) and hover contrast - #316

Merged
Castellon-ACM merged 1 commit into
trunkfrom
fix/cookie-notice-link-a11y
Sep 30, 2026
Merged

Castellon-ACM merged 1 commit into
trunkfrom
fix/cookie-notice-link-a11y

Conversation

@Castellon-ACM

@Castellon-ACM Castellon-ACM commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #315.

What changed

  • Link text: the cookie-policy link previously always said "Learn more" (Spanish: "Más información") regardless of what the linked page actually is. That fails WCAG 2.4.4 (Link Purpose in Context) — out of context (e.g. a screen reader's "list all links"), there's no way to know it goes to the cookie policy. Now it uses the linked page's own title (get_the_title( $policy_page_id )), falling back to the original "Learn more" string only if the page has no title.
  • Hover/focus contrast: .frbl-cookie-notice__link had no explicit :hover/:focus color, so a theme's own global a:hover style could take over and make the link's text unreadable against its background (reported live on a production site). Added explicit hover/focus rules mirroring the pattern already used for .frbl-cookie-notice__button:hover, plus a visible :focus-visible outline.
  • Removed white-space: nowrap from the link, since a real page title can be longer than "Learn more" and shouldn't be forced onto one line/overflow.

Tests

  • New tests/Unit/CookieNoticeLinkTest.php: policy-page-title used as link text, falls back to "Learn more" when the page has no title, no link rendered when no policy page is configured.
  • composer lint / composer phpstan: clean.
  • Could not run composer test locally (no WordPress test DB provisioned in this environment) — relying on CI's PHPUnit workflow to confirm.

🤖 Generated with Claude Code

Open WordPress Playground Preview

The banner's cookie-policy link was always labeled with the generic
"Learn more" string, which fails WCAG 2.4.4 (Link Purpose in Context) —
out of context, a screen reader user has no way to know it leads to the
cookie policy. Use the linked page's own title instead, falling back to
"Learn more" only if the page has no title.

Also add explicit hover/focus color rules to .frbl-cookie-notice__link,
which previously had none — letting a theme's own global a:hover style
take over and make the link's text unreadable against its background.

Closes #315

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@Castellon-ACM
Castellon-ACM merged commit c86e520 into trunk Sep 30, 2026
7 checks passed
@Castellon-ACM
Castellon-ACM deleted the fix/cookie-notice-link-a11y branch September 30, 2026 07:36
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.

Cookie Notice: "Learn more" link fails WCAG 2.4.4 (no destination context) and disappears on hover

1 participant