-
Notifications
You must be signed in to change notification settings - Fork 679
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] fit-content() vs 'stretch' alignment #1732
Comments
If I'm understanding your proposal, you mean that the Probably that can make sense from the authors point of view, but it'll make more complex the implementation of the stretch phase of the algorithm.
Probably we'd need to specify how this will work in 11.8. Stretch auto Tracks. BTW, this is an editorial nit, but shouldn't the 11.8 section mention that tracks only stretch if
|
That's was my first thought when @mrego told me about the issue. Whoever (now with my implementor hat on) there are edge cases. For example, what about a fit-content(100px) track hosting a 200px item? It'll be sized to 200px, so we have already surpased the limit, would it make sense not to stretch it? I don't know 😄 I guess we need the opinion of the authors here to know what do they expect. From the implementation POV I think either solution would be fine anyway. |
With this proposal contradicts, if we don't add additional info, what the Alignment spec states about the 'stretch' value:
There are different cases: |
The CSS Working Group just discussed The full IRC log of that discussion<dael> Topic: fit-content() vs 'stretch' alignment<dael> github topic: https://github.com//issues/1732 <dael> fantasai: rachelandrew and rego found spec issues about stretch and fit-content and stretch will stretch past the specified limit and that doesn't make sense. <rachelandrew> the interop issue is described here https://github.com/rachelandrew/gridbugs#14-fit-content-is-stretching <dael> fantasai: There's 2 options. 1) only have stretch stretch auto tracks but not fit-content. 2) Have stretch work on fit-content up to the limit. <dael> fantasai: 2 is more complex to impl but may be more expected. <dael> Bert: I'm having trouble visualizing. Other people understand? <dael> fantasai: I'm happy to defer if people want more time. <dael> gregwhitworth: I prefer to wait. I didn't review in depth. <dael> Bert: How much time? <dael> gregwhitworth: Just a week. I want to run Rego's comment on impl past our devs. <dael> fantasai: There's also two options for if we do stretch...do we stretch other tracks once these have reached their limit or just say nope. <dael> jensimmons: From author side havign a track with fit-content grow and shrink would be expected. And I think that once the fit-content limit is hit having additional space appear get distributed through the rest of the grid would also make sense, not have the grid stop growing. <dael> jensimmons: I don't know the implication for impl. Super quick issue reading from rachelandrew's github of grid bugs it looks like that's what other authors expect. Correct me if I'm wrong rachelandrew <dael> rachelandrew: I thinkt he author that raised it thought stretching was correct, but I found authors assume Chrome is correct. They tend to assume the browser they user the most is correct so I take it with a pinch of salt. <dael> Bert: So if we come back next week that's enough time to investigate? <dael> jensimmons: Is what I tried to articulate what FF does? <dael> rachelandrew: FF doesn't stretch. If you align to start you get the same with everything. Chrome is stretching. <dael> jensimmons: It would be nice...Oh there's a demo here. <dael> jensimmons: I'm fine punting to next week. <dael> fantasai: If people have opinions or thoughts please add comments to the issue. <dael> Bert: So there are impl difference so at least one will have to change. <dael> Bert: Please add your thoughts to the issue and we'll come back next week. <gregwhitworth> Edge doesn't stretch either in the case provided |
The Working Group just discussed The full IRC log of that discussion<dael> Topic: fit-content() vs 'stretch' alignment<dael> github: https://github.com//issues/1732 <dael> astearns: I'm not sure what's left. Can anyone summerize? <tantek> looks like we discussed it last week <dael> TabAtkins: No one removed the agenda+ |
Could you please re-discuss this topic and make a resolution?
This is not something big but it's currently an interop issue, so it'd be nice to know what's the expected behavior to update implementations. |
I've shown |
The Working Group just discussed
The full IRC log of that discussion<dael> Topic: fit-content() vs 'stretch' alignment<dael> github: https://github.com//issues/1732 <dael> Rossen_: fantasai can you take this? <dael> fantasai: I haven't looked lately. Looking now. <dael> Rossen_: I think you brought this up 3 weeks ago. <dael> fantasai: I think in order to make progress on writing modes we should do florian's extra. <dael> Rossen_: Grid issue you want to discuss on GH? <fantasai> https://github.com//issues/1732 <dael> fantasai: no...it's okay. <dael> fantasai: Issue was we have a stretch value for alignt and justify content. These align and justify grid tracks from a high level. One of the options is strech, kinda like flex lines. If you choose stretch we do so by distributing space to auto-size columsn euqually. No auto sized columns, nothing happens. <dael> fantasai: Q is if it should apply to fit-content or not. Looks like rachelandrew asked a few authors and they expect it not to go past argumenet of fit content, but there was a question of should we apply the extra space at all. <dael> fantasai: WE can say fit content doesn't go past its argumenet due to stretching. <dael> Rossen_: I'm in favor as an impl. <fantasai> s/WE/For sure I think we/ <dael> Rossen_: Obj to resolving that fit-content does not grow past its arguement due to alignment stretch. <dael> RESOLVED: fit-content does not grow past its arguement due to alignment stretch <rachelandrew> this was the issue as it came up https://github.com/rachelandrew/gridbugs/issues/9 <dael> fantasai: Second is should fit-content grow past it's max content...if we're below the argument, the clamping one, do we grow fit-content it the stretch is set. <dael> fantasai: For that question, I don't know. We don't seem to have any feedback one way or another of what should happen there. <dael> jensimmons: Alternately the content would not stretch? <dael> fantasai: If there's auto tracks there, if not start. <dael> jensimmons: And they could adjust by not using stretch? <dael> fantasai: Yes, case where it would make a difference is if there's fit-content and an auto column. They have very similar behavior except fit-content has additional clamp. <dael> Rossen_: This scenario was a canonical example we had originally when working on grid. The ability to have a menu system based on size of items inside and let the extra space go into the rest of the content area. Using fit-content with auto columns or fr columns was the way to achieve this. <dael> Rossen_: If you take away the guar. of fit-content that's not just for grid and we start changing what fit-content means then this is a pretty, in my opinion, radiacal change. <dael> Rossen_: I haven't seen any really strong cases to change that and I would prefer if we don't (as an impl) <dael> jensimmons: You want to stretch beyond max-content? <dael> Rossen_: I don't. <dael> fantasai: Auto will go beyond max-content, but fit-content won't. <dael> Rossen_: fit-content was designed to fit content <dael> rachelandrew: I'd agree with Rossen_ I don't think people would expect it to stretch. I'd prefer fit-content stays the way it is. <dael> Rossen_: We're at top of hour. <dael> fantasai: We should go for resolving <tantek> +1 <dael> Rossen_: Obj to keep fit-content behavior as-is, to not grow past max-content in presense of stretch <dael> RESOLVED: keep fit-content behavior as-is, to not grow past max-content in presense of stretch |
A test has been added as part of the Blink patch to modify the behavior: web-platform-tests/wpt#7436 |
@rachelandrew and @mrego found some problems with the spec for
fit-content()
and its interaction withstretch
content alignment of the tracks:When we wrote the spec for
fit-content()
, theauto
in the formula was intended as a replacement for themin-content
argument of the shrink-to-fit formula, as is made clear in the parenthetical “(i.e. minmax(auto, max-content))”. Removing the wordauto
and substituting the parenthetical in its place makes the intended behavior much clearer.However, there is a remaining question: should that
max-content
argument actually beauto
, i.e. respond to stretching (which is the only difference betweenauto
maximums andmax-content
maximums)? It would still be clamped by the argument as Rachel requests, since once the track hits that limit it should be treated as a fixed-size track:I'm leaning towards yes, since having
fit-content()
behave exactly likeauto
aside from clamping at its argument seems like a useful and friendly behavior, but other thoughts welcome~The text was updated successfully, but these errors were encountered: