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] auto min size definition is circular #3581

Closed
Loirooriol opened this issue Jan 31, 2019 · 6 comments
Closed

[css-grid] auto min size definition is circular #3581

Loirooriol opened this issue Jan 31, 2019 · 6 comments

Comments

@Loirooriol
Copy link
Contributor

From https://drafts.csswg.org/css-grid/#min-size-auto,

However, if the grid item spans only grid tracks that have a fixed max track sizing function, its specified size suggestion and content size suggestion in that dimension (and the input to the transferred size suggestion in the other dimension) are further clamped to less than or equal to the stretch fit the grid area’s size (so as to prevent the content-based minimum size from forcing overflow of its fixed-size grid area).

This assumes that the grid area’s size is known, but the sizing algorithm uses the used value of the minimum size e.g. in https://drafts.csswg.org/css-grid/#min-size-contribution

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

The condition already checks that the track sizing function is fixed, so I would just clamp by that value instead of by the grid area’s size which may not be known yet.

@fantasai
Copy link
Collaborator

Can't just use the track sizing function, because there's multiple tracks involved here, but I see what you're saying, we need to clamp by what the grid area would be if the min functions were all zero (effectively).

@Loirooriol
Copy link
Contributor Author

Loirooriol commented Jan 31, 2019

Can't you just sum all the track sizing functions of the involved tracks, and the gaps in between?

@fantasai
Copy link
Collaborator

It's not quite that simple, 'cuz percentage gaps.

fantasai added a commit that referenced this issue Jan 31, 2019
@fantasai
Copy link
Collaborator

Alright, lmk if that works?

@Loirooriol
Copy link
Contributor Author

That works for me.

However, gutters behave basically like tracks, so maybe a gutter with indefinite percentage should prevent the clamping, just like a track with an indefinite percentage would do?

Though https://drafts.csswg.org/css-align/#ref-for-typedef-length-percentage%E2%91%A1 says that indefinite percentage gaps should be resolved against zero, which is consistent with your edit.

@fantasai
Copy link
Collaborator

No they definitely should not prevent the clamping. That wouldn't give useful results in real life.

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

2 participants