Bug 123507

Summary: `min-width: -webkit-min-content` on fieldset
Product: WebKit Reporter: Cornelis <cornelis>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: arthurmkang, dbates, markdotto, selenit, simon.fraser, webkit, zalan, zcorpan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://jsfiddle.net/cornelis/Sxyn2/8/
Bug Depends on:    
Bug Blocks: 188643    

Description Cornelis 2013-10-30 05:00:57 PDT
I've been struggling with fieldsets that have (percentual) paddings and width all of a sudden bleeding out their parent tags. A little test that exposes the issue may be found here: 


1. Resize the browser window (the width of the viewport) form quite wide to fairly narrow in Chrome 30 or Safari 7.0. 
    -> You will see the fieldset bleeding out of it's parent element. In this case the body element. 
2. Then remove the comments of CSS line 29 and try again. 
    -> It then behaves like trident and gecko or the old webkits. 

It appears to be caused by the agent default style `min-width: -webkit-min-content`. Presumably it entered Webkit with this commit: http://trac.webkit.org/changeset/143479

This addition to the user agent default style sheet makes the behaviour of Webkit suddenly entirely different from Gecko and Trident. Six of my websites broke in Chrome and Safari this year that have looked perfectly well before. It took a while before I found out that the cause was not in my own stylesheet but in the agent's style sheet. Of course once it's known, it's easy to patch it by putting `min-width: 0` in the site's style sheet, but many people wouldn't get that idea and my suspicion is that many people who treat fieldset in a similar way have been struggling with their designs since a few months, not understanding what is going on.

Would it be an idea to take this styling out of the agent style sheet again and handle the default treatment of fieldsets in a different manner?
Comment 1 Mark Otto 2014-04-30 19:01:16 PDT
Confirming that I've run into this at http://jsfiddle.net/tde5p/10/ and https://github.com/twbs/bootstrap/issues/12359.
Comment 2 Chris Rebert 2014-10-05 07:11:04 PDT
Parallel Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=504622
Comment 3 Ilya (SelenIT) 2014-10-07 12:51:20 PDT
I believe that `min-width: min-content` emulates the default behavior of fieldset element in most browsers in typical use cases (with no circular dependencies between widths of container and content). It also follows HTML5 specs (https://html.spec.whatwg.org/multipage/rendering.html#the-fieldset-and-legend-elements and http://www.w3.org/html/wg/drafts/html/master/rendering.html#the-fieldset-and-legend-elements) and gives an easy way to change this behavior if necessary by chanaging the `min-width` property. So having `min-width: min-content` itself by default for fieldset is not a bug.

There could be a bug in the implementation of `min-content` algorithm (http://dev.w3.org/csswg/css-box/#min-content) for the case when the width of child element depends on the container width (or the spec changed since the implementation). I didn't test it.
Comment 4 Chris Rebert 2015-09-04 13:46:18 PDT
I agree that this bug seems invalid given the referenced section of the HTML5 spec.
Comment 5 Simon Pieters (:zcorpan) 2018-08-14 05:15:29 PDT
This bug is invalid and can be closed.
Comment 6 Sam Sneddon [:gsnedders] 2022-06-21 14:50:45 PDT
*** Bug 35622 has been marked as a duplicate of this bug. ***