A caption between a figure's image and its legend is overlapped by the legend
Back to our planProblem
In plain words: when an image has both a legend (the numbered key under a diagram) and a caption, the legend hangs up over the caption's last line, so the source note is partly hidden. Found while adding the source note to the I-94 post (#637): the note could not go in the image's caption field, so it is still body text under the diagram key.
How to see it: in Admin, give a Media document used in a mediaBlock followed by a diagramKey a Caption, and open the post's Live Preview. The legend's top edge (LEGEND_HANG / LEGEND_TUCK in src/platform/ui/layoutSizes.ts, which pull it up by --figure-gap and --legend-overlap) lands on the figcaption the image renders from Caption.
Proposed fix
Make the legend and the caption one unit that cannot overlap: the legend hangs from whatever is directly above it, or the caption renders after the legend inside the same figure. Decide which with the existing MediaBlock, Legend and Caption components first (reuse, no new component), test it first (a component test for the figure with both a legend and a caption), and check it at the six widths in light and dark.
Acceptance criteria
- Not done: An image with a legend and a caption shows both fully, with no overlap, at 320 to 1920 px, light and dark.
- Not done: An image with only a legend, or only a caption, looks as it does today.
- Not done: A test covers the figure with both.
- Not done: #637's diagram note can then be moved into the Media caption and fine print.
Area
frontend
Priority
priority: medium
Generated by Claude Code, opens in a new tab