Skip to content
SprecherEast
Issue 572

bug: White text on post and event photos can disappear on bright photos

Back to our plan
Done
bugfrontendstylinguxpriority: high

Problem

In plain words: white text on a post or event photo can vanish when the photo is bright (sky, snow, a white building). Every word on a photo must be readable whatever the photo looks like.

Summary of the owner's feedback (2026-11-02, Claude in Chrome side panel): white text sometimes blends into the white parts of the image and is hard to read, so add a shadow, such as a drop shadow, to keep it readable even when the background is exactly the same color as the text.

Today (checked in the code): in PageHeader · image (src/platform/ui/PageHeader.tsx) the only darkening is a fade over the bottom half of the photo (h-1/2 bg-linear-to-t from-scrim to-transparent). A title that wraps to two or three lines reaches the top half, where the fade is almost clear, so white letters sit on the bare photo. The category badges are fine: they have their own dark backing (Badge · on-image, bg-scrim/60, already checked over white in src/platform/theme/tokens.ts, SCRIM_PAIRS). The fact labels use text-on-image/70 (thinner). There are also two unused helpers, .hero-text-shadow and .hero-text-shadow-sm, in src/app/(frontend)/globals.css, and the home hero (src/modules/site/ui/PageHero.tsx) writes its own long [text-shadow:…] by hand.

Proposed fix

Why not a drop shadow alone (a technical choice, decided here): a shadow only darkens a few pixels around each letter's edge. On a white photo the letter itself is still white on white, thin strokes and small text still fail, and nobody can measure its contrast. A scrim (a see-through dark layer behind the text) sets a minimum darkness we can test, whatever the photo. So: a stronger scrim behind all the text, plus a subtle text shadow for crisp edges. That is the owner's idea done the reliable way; it doesn't need his approval.

  • Scrim: cover the whole text area, not only the bottom half: a fade from about 80% scrim at the bottom to about 50% at the top of the title block (bg-linear-to-t from-scrim/80 via-scrim/55 to-scrim/20, tune in screenshots). Measured over a pure white photo: white text on 50% black over white is about 4.0:1 (passes AA for large text such as the title), on 80% about 12.6:1.
  • Text shadow: Tailwind v4 (the lockfile has 4.2.1) has text-shadow-* size utilities and a colour form; use a theme colour (text-shadow-scrim/…), never a raw colour (lint, eslint.theme.config.mjs). Verify the exact utility names in Tailwind's docs for the installed version. Apply it to the title and any text on the photo; skip it on the badges, which have their own backing.
  • One helper: replace the two unused .hero-text-shadow* classes with the one utility, and use it in PageHero.tsx instead of its hand-written shadow (fix what you touch).
  • Contract test: add the title's worst case (on-image over the scrim at its lightest point, over white) to SCRIM_PAIRS in tokens.ts with the large-text minimum (3:1), so themes.test.ts fails if someone weakens the scrim later. If issue "Smaller photo and title" keeps any small text on the photo, it gets the 4.5:1 check instead.
  • How to test with a white photo: add a pure white image and a white-sky photo to the gallery's PageHeader · image example (src/app/(frontend)/dev/gallery/HeadersGallery.tsx) and screenshot it, plus a post whose photo is a white image in a local seed.

Native first: Tailwind's own text-shadow and gradient utilities and the existing scrim token. Nothing to add.

Acceptance criteria

  • Not done: With a pure white photo, every word on the photo (badges, title, any facts or link) is readable at all six widths (320, 430, 768, 1024, 1280, 1920), light and dark mode; screenshots in the PR.
  • Not done: The title's worst-case contrast is tested in tokens.ts / themes.test.ts and meets WCAG AA (3:1 large text; 4.5:1 for any normal-size text left on the photo).
  • Not done: No raw colours in classes (lint passes); the unused .hero-text-shadow* helpers are gone or used.
  • Not done: A dark photo still looks natural (the scrim doesn't turn it into a black box); a before/after screenshot of the I-94 post is in the PR.
  • Not done: The home page hero still looks as it does today.

Area

frontend, styling, ux

Priority

high


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab