Skip to content

[css-sizing] Effect of 'min-size: auto' on aspect-ratio constrained boxes should probably be axis-specific #5268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tabatkins opened this issue Jun 29, 2020 · 1 comment

Comments

@tabatkins
Copy link
Member

Given this example (from here):

<div style="height: 100px; aspect-ratio: 1 / 1; width: max-content;">
  <div style="display: inline-block; width: 150px;"></div>
  <div style="display: inline-block; width: 150px;"></div>
</div>

'height' is specified. 'width' is also specified, but per our guidelines, it resolves to the upper bound of the fit-content algo, which means it pays attention to the aspect ratio, and resolves to '100px'.

The implicit 'min-width: auto', tho, needs to resolve based on the "min-intrinsic size" (again, per notes, not yet per spec), so that it can override a-r when needed to prevent overflow. This means it would resolve to '150px', leading to a 150x100 box.

This probably isn't what authors expect! Protecting against overflow in the block axis seems useful, as it will be common and hard to defend against, but overflow in the inline axis is generally rare, and often intentional when it occurs.

It's not completely clear what behavior an author would expect from that code, but it seems likely that 150px width, breaking the aspect ratio, isn't it. We could fix this by defaulting "auto" to "min-content" in the inline axis and "min-intrinsic" in the block axis.

(Remember that, in the absence of aspect-ratio, the two terms have identical behavior.)

@fantasai fantasai changed the title [css-sizing] Effect of 'aspect-ratio' on 'min-size: auto' properties should probably be axis-specific [css-sizing] Effect of 'min-size: auto' on aspect-ratio constrained boxes should probably be axis-specific Jun 29, 2020
aethanyc referenced this issue in web-platform-tests/wpt Sep 11, 2021
… element.

If the flex item is a non-replaced element and its min-width/min-height
is 'auto', the spec has changed so that it has no transferred size
suggestion now. https://drafts.csswg.org/css-flexbox-1/#min-size-auto

This patch also updates WPT tests to fix
#27878

Differential Revision: https://phabricator.services.mozilla.com/D112830

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1703304
gecko-commit: fb14e6d29a44a79efc296cc727f92aa58ea4dacc
gecko-reviewers: dholbert
@davidsgrogan
Copy link
Member

We could fix this by defaulting "auto" to "min-content" in the inline axis

Is this identical to defaulting "auto" to 0 in the inline axis? If not, what's a case where they differ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants