Skip to content

Fix footer color contrast and landmark coverage - #20882

Open
0xABCD01 wants to merge 2 commits into
pypi:mainfrom
0xABCD01:fix/footer-accessibility-20785
Open

0xABCD01 wants to merge 2 commits into
pypi:mainfrom
0xABCD01:fix/footer-accessibility-20785

Conversation

@0xABCD01

@0xABCD01 0xABCD01 commented Nov 3, 2026

Copy link
Copy Markdown

Fixes #20785

Four changes from the axe-core findings in #20785:

Color contrast

  • .sponsors__description (_sponsors.scss): $text-color alpha reduction -0.4 → -0.25. The effective color over the page background goes from #8f8f8f (3.17:1) to #747474 (4.61:1).
  • .footer__tagline (_footer.scss): $white alpha reduction -0.2 → -0.1. Effective color over the footer background goes from #cce2f0 (3.96:1) to #e6f1f7 (4.61:1).

Both are the smallest alpha step (in 0.05 increments) that reaches 4.5:1, computed with the WCAG relative-luminance formula; the script reproduces the ratios reported in the issue for the current values before applying the change.

"Donate today!" button focus

The generic .button hover/focus color (#004d7a) sits at ~1.7:1 on the footer background. Inside .footer__donate, hover/focus/active now keep the label white (5.30:1) with a solid white border, and :focus-visible gets a 2px white outline with a 2px offset (5.30:1 against the footer background, above the 3:1 non-text requirement).

Landmarks

base.html now renders the sponsors include and .legal-footer inside <footer> instead of after it. Small compensations keep the rendering unchanged:

  • .sponsors gets background-color: $background-color — inside the footer it would otherwise sit on the footer blue, breaking the sponsor text contrast fixed above.
  • .legal-footer pins color: $text-color — it previously inherited the body color; inside .footer it would inherit white on its own light background.
  • .legal-footer links use the standard primary-underlined-link colors — inside .footer they would otherwise take the white .footer a styling (about 1.05:1 on the legal footer's light background).
  • Sponsor links keep their dark focus outline — .footer a:focus would otherwise paint it white on the light sponsors background.
  • .footer drops its bottom padding (40px desktop / 20px mobile), which would otherwise leave a blue strip below the legal footer; the sponsors and legal blocks provide the closing spacing, as they did outside the footer.

Verification

  • Contrast ratios computed with a WCAG luminance script (reproduces the issue's measured values for the old colors).
  • sass compiles the three changed blocks and the full warehouse.scss bundle.
  • stylelint passes on the three changed SCSS files with the repo configuration.
  • Template change checked statically: sponsors include (line 507) and legal footer (508) now sit between <footer> (354) and </footer> (527).

- sponsors description: text alpha -0.4 -> -0.25 (3.17:1 -> 4.61:1)
- footer tagline: white alpha -0.2 -> -0.1 (3.96:1 -> 4.61:1)
- footer donate button: keep label white on hover/focus/active and
  use a 2px white focus-visible outline (focus was ~1.7:1)
- base.html: render sponsors row and legal footer inside <footer>;
  sponsors keeps the page background, legal footer keeps body text
  color, and the footer drops its bottom padding

Fixes pypi#20785 (prepared locally, not yet submitted)
Moving .legal-footer and .sponsors inside <footer> subjects their links
to .footer a (white text, white focus outline), which is nearly
invisible on their light backgrounds. Restore the standard link colors
in .legal-footer and the dark focus outline for sponsor links.
@0xABCD01
0xABCD01 requested review from a team as code owners November 3, 2026 12:02
@nlhkabu nlhkabu added the UX/UI design, user experience, user interface label Nov 3, 2026

This branch has not been deployed

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

Labels

UX/UI design, user experience, user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Footer accessibility: color contrast failures and content outside landmarks

2 participants