w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.46k stars 657 forks source link

Stacking order + 'z-index' spec #4965

Open fantasai opened 4 years ago

fantasai commented 4 years ago

Filing this issue to track that we need a stacking/painting order spec. Topics should include (note this list has been edited substantially since the issue was initially filed):

(Feel free to edit this description to add more tracking items, or comment below and I'll edit if you don't have permissions.)

Loirooriol commented 4 years ago

CSS2 seems to assume that stacking contexts can only be established by positioned elements with non-auto z-index (and the root element).

But now we have plenty of ways for that. Like the transform and opacity listed above, but also will-change, contain, isolation, filter, perspective, etc. The new text should not make assumptions about how the stacking context was established, since other specs can introduce new ways of establishing it.

dbaron commented 4 years ago

It should specify the resolution of #2717.

dbaron commented 4 years ago

Also, I'd probably name the spec "CSS Painting Model" or something along those lines. And it definitely needs to define terms for the various things that can happen (mentioned in the previous 2 comments) that other specs can hook into.

BenjaminAster commented 1 year ago

z-index is now the only CSS property that is not defined anywhere outside of the CSS2 spec, so I think creating a spec for it (or merging it into an existing one) would be a big step forward in making the CSS2 specification obsolete.

Loirooriol commented 1 year ago

Painting order and stacking contexts are now in https://drafts.csswg.org/css-position-4/#painting-order, so I guess z-index could be there too.

tabatkins commented 1 year ago

Oh yeah it should definitely live in Position.

dbaron commented 1 year ago

For now I think that's fine, though in the long term I think we should really have a CSS painting model spec (as discussed at least once in the past).

dbaron commented 1 year ago

I just edited the initial comment to include the other things that have been raised here, and in that other linked discussion. (The list more than doubled in length, I think.)