Skip to content
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

[css-grid] Do all percentages behave as auto when computing minimum contribution? #3612

Open
Loirooriol opened this issue Feb 4, 2019 · 2 comments

Comments

@Loirooriol
Copy link
Collaborator

commented Feb 4, 2019

From https://drafts.csswg.org/css-grid/#algo-single-span-items,

The minimum contribution of an item is the outer size that would result from assuming the item’s used minimum size (min-width or min-height, whichever matches the relevant axis) as its preferred size (width or height, whichever matches the relevant axis) if its computed preferred size behaves as auto, or else the item’s min-content contribution otherwise.

Percentages in preferred size are resolved with respect of the grid area. The grid area is being calculated, so I guess all percentages should be considered to behave as auto?

The change was done in #2367 as an Obvious Bugfix. Well, it doesn't seem that obvious to me, because the change was against the behavior of all Blink, Firefox and Edge at that time (Firefox later adapted to the spec in https://bugzil.la/1462854). In this example, there is no longer a green background in Firefox, but there is in Blink and Edge:

<div style="width: 0px">
  <div style="display: grid; float: left; background: lime">
    <div style="min-width: 0px; width: 100%">content</div>
  </div>
</div>

I just want to confirm whether my understanding of the spec is correct and whether this implication was intentional. In #2367 @MatsPalmgren said "percentages should behave as auto when the percentage basis is indefinite" like implying only some percentages were affected, but it seems to me that all of them are affected.

@Loirooriol

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 18, 2019

In https://crbug.com/931474 I have fixed Blink to behave like Firefox.

fantasai added a commit that referenced this issue Jun 7, 2019

[css-grid-1] Clarify cases where the minimum contribution derives fro…
…m the minimum size rather than the min-content contribution. #3612
@fantasai

This comment has been minimized.

Copy link
Collaborator

commented Jun 7, 2019

OK, clarified the spec by saying "behaves as auto or depends on the size of its containing block in the relevant axis". (Also did some editorial restructuring to make it easier to read.) See https://drafts.csswg.org/css-grid-1/#min-size-contribution

@MatsPalmgren I'd appreciate your review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.