[css-flex] Min-content sizing currently too smart to be web compatible? · Issue #2353 · w3c/csswg-drafts (original) (raw)

Hi css-flexers from all around the world,

I just wanted to report that our attempt to update our flex implementation sizing algorithm to match the spec encountered a few hiccups, but this one seems like the most concerning so far:

https://wptest.center/#/677dj4 (CSS Flexbox min-content size seems problematic)
image vs image

The pattern we are seeing is authors using <div style="background: url(icon.png); width:32px; height:32px"> in min-content sized/constrained flexboxes, and the icon ends up disappearing because flex-shrink defaults to 1 by default.

I think we should update the specification such that an explicit width acts as a minimum width (even though it could theorically be shrunk).

In general, the automatic minimum size of a flex item is its specified size if it is defined, or its content size otherwise. However, if the box has an aspect ratio and no specified size, its automatic minimum size is the smaller of its content size and its transferred size. If the box has neither a specified size nor an aspect ratio, its automatic minimum size is the content size.

instead of

In general, the automatic minimum size of a flex item is the smaller of its content size and its specified size. However, if the box has an aspect ratio and no specified size, its automatic minimum size is the smaller of its content size and its transferred size. If the box has neither a specified size nor an aspect ratio, its automatic minimum size is the content size.