Closed Bug 1483499 Opened 6 years ago Closed 6 years ago

<legend> not child of <fieldset> should have 2px padding

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: zcorpan, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

WebKit/Chromium/EdgeHTML always have 2px padding. For Gecko html.css says `fieldset > legend` instead of just `legend`.

See https://github.com/whatwg/html/issues/2729

Test: 
http://web-platform-tests.live/html/rendering/non-replaced-elements/the-fieldset-element-0/legend.html
Simon makes a reasonably compelling argument -- the current "fieldset >" qualifier means that we get different amounts of padding depending on whether the legend is inside of "display:contents" or not.

Kind of a strained scenario to design for, but there's some logic to the idea that there should be consistency there -- and given that plus the consensus of other browsers, it seems reasonable to change here.
Priority: -- → P3
Here's a testcase with the display:contents scenario: https://jsfiddle.net/xmcpsozh/
If you view that in Firefox and look closely [or use devtools to inspect computed style], you can see that the display:contents-nested legend has less padding than the normal legend.
Blocks: fieldset
Mihir might take this -- tentatively assigning this to him.

All we need to do here is:
 (1) Merge this all into a single "legend { ... }" rule (no fieldset > legend):
https://dxr.mozilla.org/mozilla-central/rev/4e56a2f51ad739ca52046723448f3129a58f1666/layout/style/res/forms.css#58-66

 (2) Write a reftest based on my jsfiddle from comment 2, with a display:contents wrapper around <legend> in the testcase and without it in the reference case.
Assignee: nobody → miyer
Status: NEW → ASSIGNED
I'll go ahead and close this out. Note that I'll be leaving behind one "fieldset > legend" declaration here -- that one's covered by bug 1485502.
Assignee: iyermihir → dholbert
Try run w/ reftests, all platforms (to validate that new tests pass everywhere & to catch possible changes in number of fuzzy pixels on platform-specific fuzzy annotations):
  https://treeherder.mozilla.org/#/jobs?repo=try&revision=c739c00aa6d36384cfa2bf66b1c048b242853c88

Try run w/ all layout-relevant tests, linux-only (to catch any other test dependencies on old behavior):
  https://treeherder.mozilla.org/#/jobs?repo=try&revision=4b47c71fd59f319dd46a2d897c8b366a3cb5668f
Hmm, looks like I've got some test expectations to update.
Comment on attachment 9003318 [details]
Bug 1483499: Give <legend> consistent default padding, regardless of whether it's a child of fieldset. r=mats

Mats Palmgren (:mats) has approved the revision.
Attachment #9003318 - Flags: review+
Pushed by dholbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fc18abb2ea52
Give <legend> consistent default padding, regardless of whether it's a child of fieldset. r=mats
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/12682 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
https://hg.mozilla.org/mozilla-central/rev/fc18abb2ea52
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: