Re: [csswg-drafts] [css-animations-2, css-transitions-2] Entry and exit animations for top-layer elements (#8189)

> I don't see that as a downside. I think this makes sense given z-index doesn't apply in the top layer, and top layer overrides any other z-index.

I'm not sure how that addresses the concern. While an element is *not* in the top-layer, its z-index can matter. When it *is* in the top-layer, its z-index doesn't matter (unless we use a new 'overlay' value to indicate its top-layer-ness). So using a transition to delay exiting the top layer has to be carefully scoped so it doesn't accidentally apply to other changes in z-index an element might have (because, presumably, they'd want different and likely unrelated transition behavior; most likely "no transition").

A new specialized property, on the other hand, avoids this concern - you can naively set a transition on the property, and it only applies in the expected situation.

> I'm trying to fit top layer into the pre-existing the CSS models, which I do think it leads to a better developer experience it we manage to do so, rather than introducing a new model. E.g. imagine being a web developer knowing nothing about the top layer (which is expected in most cases), but knowing basic CSS, what would be their first intuition to solving the problem?

This is something I'm quite concerned about wrt re-using z-index, in fact (or any other property). z-index can be set by the author to any desired value, to put an element in a particular painting order wrt other elements in its stacking context. Elements *cannot* be put in the top layer via setting a property (and we'd have to define some magic mechanism forcing the computed value back to 'none' if the author tried to do so). The top layer also acts only *roughly* like z-index; it pulls you all the way out to the root stacking context rather than paying attention to the nearest ancestor stacking context. And then *within* the top-layer, ordering is totally different from how z-index works - z-index sorts by value, then DOM order, while top-layer is strictly based on top layer order (which is roughly the temporal order things were added, with no relation to DOM order at all).

All told z-index is *similar thematically* to top layer, but in virtually every specific it's different, and conflating them is imo likely to lead to significantly more confusion than not. A new property requires new learning, sure, but the *purpose* of the new property is very narrow in the first place (it exists *solely* to allow an author to add a transition that delays its value change, which is pretty weird).

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8189#issuecomment-1490908782 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 30 March 2023 20:28:05 UTC