WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
323711
Only a fieldset's rendered legend should shrink to fit
https://bugs.webkit.org/show_bug.cgi?id=323711
Summary
Only a fieldset's rendered legend should shrink to fit
Morne
Reported
2026-09-08 17:42:33 PDT
WebKit sizes every <legend> to its content, not just the one its fieldset renders in the border. RenderBox::sizesLogicalWidthToFitContent() groups HTMLLegendElement with input, select, button and textarea, so any legend with width:auto shrinks to fit. Per HTML only the rendered legend (the first in-flow <legend> child of a <fieldset>) is sized that way; any other legend is an ordinary block. Steps: 1. Put <legend>hello</legend> directly in the body. 2. Compare its computed width to an identically styled <div>. Expected: both fill the containing block. Actual: the legend shrinks to its content, and is 0px wide when empty. wpt.fyi for html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend.html: Chrome 56/56, Firefox 56/56, Safari 49/56.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2026-09-08 17:42:42 PDT
<
rdar://problem/186967632
>
Morne
Comment 2
2026-09-08 17:45:38 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/73516
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug