Skip to content
SprecherEast
Issue 654

Decide whether an image and its legend become one component, and fix the gallery sample gap

Back to our plan
Open
enhancementfrontendpriority: low

Summary

The legend (#636, merged in #638) hangs from the image above it with a negative margin and two shared CSS variables. It works and is reviewed, but image and legend are two separate blocks, so it only holds if the legend sits directly after the image. This issue looks at whether an image and its legend should become one unit, and fixes a small gallery spacing problem. It is low priority: revisit it if the fragility actually bites.

Details

  • Idea from the owner (2026-11-03, Claude voice session): a legend attached to an image, so that when there is an image, the legend comes from the bottom like a drawer and the two are one thing. He is not sure extending MediaBlock is right and asked for an honest review before building.
  • For it: no negative margin, no overlap variables, no stacking tricks; the drawer effect can't break; a caption and fine print (#635) slot in as the next layer.
  • Against it: a CMS schema change and a migration, and editors build posts differently. The current setup is tested and reusable. A Legend is also needed under vector or HTML charts that aren't a raster image.
  • Leaning: a small presentational "image with legend" component that takes an image and markers, with MediaBlock only passing the editor's data in, so chart concerns stay out of the block. Decide after #635 (the caption component), since both change the same wrapper.
  • Not a Card: the owner decided a legend is not a card, so no drawer variant on Card (Copilot's comment on #638, answered there).
  • Gallery spacing (Copilot, #638): in /dev/gallery the Legend sample sits in a GalleryVariant whose default flex flex-wrap gap-4 adds a gap that cancels the overlap. Give the sample block flow (block) so it shows the real tucked-under look. Gallery only; articles are unaffected.

Acceptance criteria

  • Not done: A written decision (on this issue) on one component vs. the current two blocks, with the editor impact.
  • Not done: If one component: image and legend in one wrapper, no negative margin or overlap variables, a test and an axe check, the gallery entry and docs/ui/component-set.md updated.
  • Not done: The gallery Legend sample shows the image and legend touching, with no gap.

Part of #570.


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab