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-position] Does the root element establish a stacking context? #8353

Closed
Loirooriol opened this issue Jan 24, 2023 · 3 comments
Closed

[css-position] Does the root element establish a stacking context? #8353

Loirooriol opened this issue Jan 24, 2023 · 3 comments
Labels
Closed Accepted as Obvious Bugfix Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-position-3 Current Work

Comments

@Loirooriol
Copy link
Contributor

https://www.w3.org/TR/CSS22/visuren.html#propdef-z-index defines z-index: auto with

If the box has position: fixed or if it is the root, it also establishes a new stacking context.

Similarly, https://drafts.csswg.org/css2/#propdef-z-index says

The box does not establish a new stacking context unless it is the root element.

But https://drafts.csswg.org/css-position/#stacking doesn't mention anything like that.

Testcase:

:root { box-shadow: inset 0 0 0 50vmax orange; height: 100%; /*position: relative;*/ /*z-index: 0*/ }
:root::before { content: "Text"; position: relative; z-index: -1 }

Firefox: the root element establishes a stacking context if not positioned or if z-index is not auto.
Blink/WebKit: the root element always establishes a stacking context.

@fantasai
Copy link
Collaborator

Added a note that the root element always forms a stacking context. (The formal definition is left to CSS2, since we haven't ported those sections over yet.) Lmk if that works for you.

@Loirooriol
Copy link
Contributor Author

Yeah I guess that works for now.

@Loirooriol Loirooriol added the Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. label Mar 30, 2023
@tabatkins
Copy link
Member

https://w3c.github.io/csswg-drafts/css-position-4/#paint-a-document also now explicitly paints the root element as a stacking context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted as Obvious Bugfix Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-position-3 Current Work
Projects
None yet
Development

No branches or pull requests

3 participants