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

contain-intrinsic-size - improve docs #20912

Merged
merged 9 commits into from
Sep 23, 2022

Conversation

hamishwillee
Copy link
Collaborator

@hamishwillee hamishwillee commented Sep 20, 2022

contain-intrinsic-size docs are incomplete and inaccurate.

More work to be done:

This is related to #20876

@hamishwillee hamishwillee requested a review from a team as a code owner September 20, 2022 06:22
@hamishwillee hamishwillee requested review from dipikabh and removed request for a team September 20, 2022 06:22
@github-actions github-actions bot added the Content:CSS Cascading Style Sheets docs label Sep 20, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Sep 20, 2022

Preview URLs

(this comment was updated 2022-09-23 12:30:11.748288)

@estelle
Copy link
Member

estelle commented Sep 20, 2022

Can we ease the reading level down? i.e. intrinsic, mitigated, and computational may not be understood by native English speakers and we have a large ESL audience.

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Containment mentions:

The specification defines a single CSS property contain ....

we should likely add this to that page.

- : The element has no intrinsic size in the given dimension(s).
- `<length>`
- : The element has the specified {{cssxref("&lt;length&gt;")}} in the given dimension(s).
- `auto <length>`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @estelle , I find auto a little tricky. The theory is pretty simple - it saves the natural/rendered size of the element whenever it is outside of size containment and then uses that instead of the stated length when appropriate.

What I don't get is why you would bother - the spec indicates this is only really used offscreen and will switch to using length for on-screen. I'm in discussion here w3c/csswg-drafts#7769 (comment) - might just be being stupid.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I get the auto thing now; it makes sense and this documentation is correct.

The auto option is mostly to get the benefits of size containment for offscreen elements without developers having to be too precise about the size of the element. It makes sense when you're skipping rendering the child elements. You don't have to worry about the fact that the length will be used when you're not skipping child elements because in this case as the element becomes visible you leave size containment and start rendering them.

If you're on screen and deliberately getting the benefits of size containment then it is up to the developer to make sure that the size is properly calculated.

Copy link
Member

@estelle estelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much easier to read! Thank you.

bsmth and others added 3 commits September 23, 2022 14:24
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
@bsmth
Copy link
Member

bsmth commented Sep 23, 2022

Thanks all. I'm going to merge this in the current state 👍🏻 it looks like we can revisit the auto value if there's an outcome from the separate discussion on the benefits there :)

@bsmth bsmth merged commit dd7b08e into mdn:main Sep 23, 2022
@hamishwillee hamishwillee deleted the contain-intrinsic-size branch September 25, 2022 23:18
himanshugarg pushed a commit to himanshugarg/content that referenced this pull request Sep 27, 2022
* contain-intrinsic-size - improve docs

* Update files/en-us/web/css/contain-intrinsic-size/index.md

Co-authored-by: Estelle Weyl <estelle@openwebdocs.org>

* Update files/en-us/web/css/contain-intrinsic-size/index.md

* Update files/en-us/web/css/contain-intrinsic-size/index.md

Co-authored-by: Estelle Weyl <estelle@openwebdocs.org>

* Simplify language

* Update files/en-us/web/css/contain-intrinsic-size/index.md

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>

* Update files/en-us/web/css/contain-intrinsic-size/index.md

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>

* Update files/en-us/web/css/contain-intrinsic-size/index.md

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>

* Update files/en-us/web/css/contain-intrinsic-size/index.md

Co-authored-by: Estelle Weyl <estelle@openwebdocs.org>
Co-authored-by: Brian Thomas Smith <brian@smith.berlin>
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants