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 contain-intrinsic-size #437

Closed
3 of 5 tasks
vmpstr opened this issue Oct 30, 2019 · 20 comments
Closed
3 of 5 tasks

CSS contain-intrinsic-size #437

vmpstr opened this issue Oct 30, 2019 · 20 comments
Assignees
Labels
Progress: pending editor update TAG is waiting for a spec/explainer update Progress: propose closing we think it should be closed but are waiting on some feedback or consensus Topic: CSS Venue: CSS WG

Comments

@vmpstr
Copy link

vmpstr commented Oct 30, 2019

Hello TAG!

I'm requesting a TAG review of:

Further details:

We'd prefer the TAG provide feedback as (please select one):

  • open issues in our GitHub repo for each point of feedback
  • open a single issue in our GitHub repo for the entire review
  • leave review feedback as a comment in this issue and @-notify primary contacts
@torgo
Copy link
Member

torgo commented Nov 5, 2019

Just a quick process question: why is this explainer in the WICG and the work is going on in CSS? Thanks.

@vmpstr
Copy link
Author

vmpstr commented Nov 5, 2019

This feature was initially a part of display-locking, which is a WICG project. We've decided that it made sense on its own, as part of CSSWG. However, the explainer remained in display-locking WICG repo. Hopefully that's not an issue.

@dbaron
Copy link
Member

dbaron commented Nov 19, 2019

I think from a TAG perspective this is fine. I was a little concerned that the early proposals were too narrow (and creating a new CSS property for something very specific when it could have been more general), but what is now specified is now more general as I was hoping.

I did give some additional feedback from my perspective as a CSS WG participant, but I don't think of that as an issue that the TAG should be concerned about.

@torgo
Copy link
Member

torgo commented Nov 19, 2019

We discussed briefly on today's call. Will try to close in 2 weeks at our f2f.

@alice
Copy link

alice commented Nov 21, 2019

I had a chat with @dbaron and @plinss about this, and spent some time looking at the spec, explainer and examples.

Firstly, the explainer seems to be out of date compared to the spec: there is no mention of intrinsic-block-sizeintrinsic-inline-sizeintrinsic-height or intrinsic-width, nor the legacy or auto value keywords.

Secondly, even looking at the spec, explainer and examples, I had trouble following what problem this proposal is solving. In particular, it was very unclear to me (even after looking at the examples) why the existing properties mentioned in the "Alternatives Considered" section weren't sufficient.

It would be very helpful to have a clear explanation/demonstration of what the precise problem is, and how the existing options behave incorrectly. The examples assert that the behaviour is incorrect, but without a clear explanation of what the desired behaviour is in each case it doesn't actually help in understanding the issue.

I would also like to understand why we have, for example, both inline-block-size and inline-width - under what circumstances would authors choose one over the other?

Finally, it seems unusual for an initial value not to be auto when an auto value exists. Could you provide some insight into that choice?

@chrishtr
Copy link

Hi, here are some responses to a couple of your points.

Secondly, even looking at the spec, explainer and examples, I had trouble following what problem this proposal is solving. In particular, it was very unclear to me (even after looking at the examples) why the existing properties mentioned in the "Alternatives Considered" section weren't sufficient.

Hmm. The explainer addresses each of these directly. Perhaps there was something missed, or the explanation could be improved.

The primary motivating use case is representing estimated placeholder sizing of a DOM subtree, to avoid layout instability and preserve scroll sizing. The browser may not have done the work for multiple reasons, some of which include:

  • Subtree content is not yet loaded
  • Subtree content was not committed, or fully committed, from VDOM or some other script-internal state
  • Subtree content has display:none
  • Root of subtree uses rendersubtree (the other part of the overall display locking proposal), and the browser skipped doing this work

There are other use cases that may arise because now the developer can specify the intrinsic sizing inputs to layout algorithms directly. One potential such use case involving control of scrollbars was brought up at TPAC (by another CSSWG member).

It would be very helpful to have a clear explanation/demonstration of what the precise problem is, and how the existing options behave incorrectly. The examples assert that the behaviour is incorrect, but without a clear explanation of what the desired behaviour is in each case it doesn't actually help in understanding the issue.

I'll try to state it as succinctly as possible: *representing estimated placeholder sizing of a DOM subtree which will be loaded and/or rendered later.

With that statement I hope it's clear why the examples state that the alternative approaches are incorrect. In those examples, the desired behavior is that a DOM subtree which has an actual sizing exactly equal to the intrinsic sizing CSS property should have exactly the same layout impact on the rest of the document. In other words: once the content has loaded and rendered, layout should remain stable.

The "existing options" don't have that behavior on the described examples.

@dbaron
Copy link
Member

dbaron commented Nov 22, 2019

All the explainer says about the alternatives is:

Elements can already be sized by width, min-width, and various other sizing CSS properties. However, these properties fall short, because they all affect not just intrinsic sizing, but other layout inputs as well. The examples section gives several examples of this.

It doesn't give examples of where using the existing properties [Edit to add: or doing nothing at all] would do something other than what the author wants. The two examples then just say "Notice layout result is not as desired." without saying what was desired or how the result is different. (Note that the examples don't currently work, even in up-to-date Chrome 78 with experimental web platform features enabled, so it's hard to understand what was intended.) For example, I think I just figured out the intent of the first example in the block-flow examples, but it required that I view source and spend five minutes thinking about what you wanted to happen in that case.

In the first example in the block-flow examples, the example is showing that while you want the element to report a 300px intrinsic width, you still want to allow it to shrink smaller than that size if its container is smaller than that size. It would be good to state that explicitly for the first example, and whatever the equivalent is for the other examples, so that the explainer actually says what it is that this property can do that the existing properties can't, rather than requiring the reader to re-derive that from the examples. Even then, the example still doesn't show why reporting the 300px intrinsic width is useful; it doesn't show it doing anything. Showing that seems to require the example be developed a little further.

@alice
Copy link

alice commented Nov 22, 2019

Perhaps there was something missed, or the explanation could be improved.

Yes, I'm asking that the explainer (and examples) be improved. Thank you.

@chrishtr
Copy link

Hi,

Vlad and I reviewed the examples links from the explainer, and did see a few errors there. We also agree that those examples don't in the end show obviously compelling use-cases, especially as compared to using min-width and min-height directly.

We're going to follow up on the CSSWG issue and propose some changes to be re-discussed there in the WG. Once that is resolved one way or the other I'll come back here and give a status update on the proposal.

Thanks for reading the explainer and examples in depth.

@alice
Copy link

alice commented Dec 3, 2019

Thanks for the update. I'm going to mark this as pending external feedback until we hear back from you.

@alice alice added Progress: pending external feedback The TAG is waiting on response to comments/questions asked by the TAG during the review and removed Progress: breakout labels Dec 3, 2019
@chrishtr
Copy link

chrishtr commented Dec 4, 2019

Sounds good. I appreciate your reviews!

@alice alice removed this from the 2019-12-03-f2f-cupertino milestone Jan 27, 2020
@cbiesinger
Copy link

CSSWG has approved some changes to this property: w3c/csswg-drafts#4531
It is now named contain-intrinsic-size and only applies if contain:size is set.

@alice
Copy link

alice commented Mar 2, 2020

@cbiesinger Thanks for the update!

I see the explainer for intrinsic-size has been removed, presumably due to that change. It's a bit hard to follow the current set of use cases for contain-intrinsic-size from that issue thread - is someone able to comment with what you had in mind when designing it?

@vmpstr
Copy link
Author

vmpstr commented Mar 2, 2020

The explainer for contain-intrinsic-size is now here and the spec draft is here. Please note that we're still working on some motivating examples to go along with the explainer.

The motivation for the change stemmed from the responses to this thread. They made us take a closer look at the value that we were providing, and realize that we inadvertently moved away from size-containment and thus moved away from much of the usefuless of the feature. Some more context is here. The change to move back to size-containment restored the use for our original use case: to act as a placeholder size when child sizing information may not be available (due to, for example, subtree-visibility).

@cbiesinger
Copy link

Apologies, the explainer got renamed: https://github.com/WICG/display-locking/blob/master/explainer-contain-intrinsic-size.md

The basic use case is for an element that changes from having contain: size applied to not having it, e.g. because of display locking, but can be useful elsewhere (virtual scrollers, perhaps) -- in such a case, it can be useful to specify a size that only applies while contained (otherwise it would be 0x0), whereas when not contained, you want it to just size based on its content.

...I see vlad responded while I was writing, oh well.

@alice
Copy link

alice commented Mar 2, 2020

Hehe, thanks for the explanations! We'll reschedule this for a later breakout session.

@alice alice changed the title CSS intrinsic-size CSS contain-intrinsic-size Mar 4, 2020
@atanassov
Copy link

@alice, @torgo and myself did another pass of this. The overall progress and shape of the feature is satisfactory from the point of view of the TAG. What used to be a fairly narrow use case and solution is now evolving in a more useful feature for the broader CSS.

One request - you should update the explainer by adding motivational use cases and examples of how your solution address it. This is of course need for developer documentation such as MDN.

@atanassov atanassov added Progress: propose closing we think it should be closed but are waiting on some feedback or consensus Progress: pending editor update TAG is waiting for a spec/explainer update and removed Progress: pending external feedback The TAG is waiting on response to comments/questions asked by the TAG during the review labels Mar 4, 2020
@torgo torgo added this to the 2020-03-09-week milestone Mar 4, 2020
@cbiesinger
Copy link

There are now examples in https://wicg.github.io/display-locking/sample-code/contain-intrinsic-size-examples.html, linked from the explainer. Thanks for the update!

@cbiesinger
Copy link

In particular example 4 is a motivating real-world example

@torgo
Copy link
Member

torgo commented Mar 11, 2020

Great to see that @cbiesinger! Thanks for the update!

@torgo torgo closed this as completed Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Progress: pending editor update TAG is waiting for a spec/explainer update Progress: propose closing we think it should be closed but are waiting on some feedback or consensus Topic: CSS Venue: CSS WG
Projects
None yet
Development

No branches or pull requests

8 participants