This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24961 - Spec needs to make it clear that fieldsets are never narrower than kids
Summary: Spec needs to make it clear that fieldsets are never narrower than kids
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-06 19:10 UTC by contributor
Modified: 2014-04-15 02:53 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2014-03-06 19:10:22 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html
Multipage: http://www.whatwg.org/C#the-fieldset-and-legend-elements
Complete: http://www.whatwg.org/c#the-fieldset-and-legend-elements
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
Spec needs to make it clear that fieldsets are never narrower than kids

Posted from: 98.110.194.132 by bzbarsky@mit.edu
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:30.0) Gecko/20100101 Firefox/30.0
Comment 1 Boris Zbarsky 2014-03-06 19:11:40 UTC
Simple testcase at http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2871 which every UA I can find renders with the fieldset wide enough for the div to fit.

This is kinda similar to what table-layout:auto table cells do, actually, but only in the horizontal direction.
Comment 2 Ian 'Hixie' Hickson 2014-03-19 20:56:30 UTC
Is there some way to describe this in CSS?
Comment 3 Tab Atkins Jr. 2014-03-19 21:01:27 UTC
That is a super-weird behavior, and I didn't realize we all did that.

No, there's nothing in CSS that would do that.  A "min-width: min-content !important;" rule in the UA stylesheet would have the right effect, but would prevent authors from specifying their own 'min-width'.  We'd need something independent that accomplished the same thing.

Do we think that this is a necessary behavior, or just something weird and random that everyone inherited?
Comment 4 Boris Zbarsky 2014-03-19 22:10:30 UTC
> No, there's nothing in CSS that would do that.

Short of "display: table-cell", kinda.

> Do we think that this is a necessary behavior

It's hard to tell.  This behavior in Gecko dates back to at least code added in https://bugzilla.mozilla.org/show_bug.cgi?id=23156 which was before my time (not often I get to say that!) and before people did sane things like decent commit comments and useful bug reports.  :(

Would be interesting to see whether other engines have a better idea of why the behavior is there.
Comment 5 Tab Atkins Jr. 2014-03-19 23:40:46 UTC
Wait, I was thinking wrong.  If we okay with sanifying this sufficiently, so that an author setting 'min-width' explicitly will change this behavior, then what I posed would do fine, just without the !important.

That is, just put a "min-width: min-content;" rule in the UA stylesheet.  Unless overridden (which is likely rare), that'll ensure that fieldsets never have less width than their widest child.
Comment 6 Ian 'Hixie' Hickson 2014-04-14 23:21:47 UTC
Do "reset.css"-style style sheets reset that? Do pages that use "reset.css"-style sheets depend on it not being reset?

I've added what Tab suggested. Let me know if it's not compatible enough.
Comment 7 contributor 2014-04-14 23:22:01 UTC
Checked in as WHATWG revision r8576.
Check-in comment: Try to be more compatible in <fieldset> rendering rules.
http://html5.org/tools/web-apps-tracker?from=8575&to=8576
Comment 8 Boris Zbarsky 2014-04-15 02:53:36 UTC
Eric Meyer's CSS reset doesn't seem to set min-width, nor do the other 4 at http://www.cssreset.com/.

But people doing "all: initial" would of course reset this property too....