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-values-4] Difference of viewport and initial containing block size #5218

Closed
vwkd opened this issue Jun 16, 2020 · 6 comments
Closed

[css-values-4] Difference of viewport and initial containing block size #5218

vwkd opened this issue Jun 16, 2020 · 6 comments

Comments

@vwkd
Copy link
Contributor

vwkd commented Jun 16, 2020

What is the difference between the size of the viewport and the size of the initial containing block (ICB)? The current spec is contradicting itself (at least for continuous media). There are two possibilities:

  1. Size is the same

Matches definition in 10.1 in CSS2.

For continuous media, [the ICB] has the dimensions of the viewport [..].

  1. Size is different

The size of the viewport is the visible part of the document without overlays (like scrollbar, on-screen keyboard), while the size of the ICB is with it.

Matches definition in note in css-values-4 on viewport-percentage lengths.

Note that the initial containing block’s size is affected by the presence of scrollbars on the viewport.


I guess it is the second? But no matter what the answer is, there is at least one bug in css-values-4.

If the answer is 1., then the note quoted in 2. is erroneous.

If the answer is 2., then the definition in 1. is erroneous (which is quoted through as still valid definition, e.g. in css-display). Additionally the definition of the viewport-percentage lengths is erroneous.

The viewport-percentage lengths are relative to the size of the initial containing block.

Yes, the spec includes the scrollbar afterwards

However, when the value of overflow on the root element is auto, any scroll bars are assumed not to exist.

But then, this is exactly the difference between the size of the viewport and the size of the ICB. So the spec should just use the correct term (viewport). Defining an exception for a term (ICB) that is used to differentiate from another term (viewport) but making the exception so the term equals the other term from which it tried to differentiate itself in the first place is ... confusing, to say the least.

@CendioOssman
Copy link

It's definitely some form of 2 in practice. (At least) Mobile browsers will create an ICB that is large enough to safely contain the largest visual viewport, which can be larger than the layout viewport.

It would probably be good to get some clarity on this, as it affects at least fixed position elements, as discussed in #8410.

@tabatkins
Copy link
Member

The spec (along with the specs defining the appropriate concepts - Display and Position) is now well-defined. The ICB is the "small viewport size" and the fixpos containing block is the layout viewport which is the "dynamic viewport size".

Commits: 5047246 and 79daa0a

@CendioOssman
Copy link

That can't be right? The containing block of a fixed element is in some cases larger than any of the viewport dimensions.

@tabatkins
Copy link
Member

Can you provide an example of one of those cases?

@hiikezoe
Copy link

hiikezoe commented Dec 4, 2023

I suppose this case is one of such cases what @CendioOssman is concerned; https://hiikezoe.github.io/vh-units.html

@CendioOssman
Copy link

It happens on mobile browsers when they are in their "desktop mode". I'll see if I can link to an example. The one @hiikezoe refers to might be relevant, but I don't have a device here to confirm it right now.

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

5 participants