Skip to content

blitz-dom: a fieldset's legend is laid out as a plain block, not a rendered legend

Generated from repros/blitz-dom-legend-not-rendered/README.md when the site was built at 7aa23e2.

Nothing in layout. A radio group that holds a legend renders it (DECISIONS.md, Elements), where blitz puts it: as wide as the fieldset’s content and below its top border. The screen comparison records the width against Chrome as a known difference (tests/screens/expectations.json, controls).

HTML’s rendering section makes a fieldset’s first legend child its rendered legend: shrink-to-fit, and placed over the fieldset’s block-start border, which the content then starts below. blitz has no rendered legend; default.css gives legend display: block and layout treats it as any block child.

  • Expected: the legend about as wide as “Size” (plus its 2px inline padding), with y < 10 (on the 10px top border).
  • Actual:
legend (30.0, 10.0, 340.0, 16.0), paragraph (30.0, 26.0, 340.0, 16.0) (in the fieldset's border box)
expected: the rendered legend is as wide as its text, about 35px of 360, and sits on the top border (y < 10)
actual: width 340.0, y 10.0
Terminal window
CARGO_TARGET_DIR=~/.capy/work/repro-target cargo run

Exit status 1 while the bug reproduces, 0 once fixed.

Not checked. Tested at the pinned be60597f67b3cece0456d26e8d7ff5a88600bbc5; main was at b6ace6a0c33e17b654e8e6d0b14a7e04e83756fe on 2026-11-09.

None searched.

Title: No rendered legend: a fieldset’s legend is laid out as a full-width block inside the border

Body:

<fieldset style="margin: 0; border: 10px solid; padding: 0 20px"><legend>Size</legend><p>Small</p></fieldset>

Browsers make the first legend child the fieldset’s rendered legend (https://html.spec.whatwg.org/multipage/rendering.html#the-fieldset-and-legend-elements): its width is shrink-to-fit and it is placed over the block-start border. blitz lays it out as a block child, 340px wide at y = 10 in a 400px fieldset. Tested at be60597.