#829: Entry and Exit Animations
Discussions
Discussed
Apr 1, 2023 (See Github)
Lea: WRT csswg-drafts/#4441 very glad they resolved the way they did instead of adding extra syntax. This is intuitive for authors, does not require learning anything else, and performant for UAs, win-win.
...: WRT csswg-drafts/#6429, this seems reasonable, but we see there is a lot of discussion after the resolution to adopt this proposal. Are the details still being fleshed out? If so, is it a good time for shipping this?
...: Note, dialog example explainer has a bug, step-end
will only work one way.
... WRT csswg-drafts/#8174, agree that use case should be solved.
A bit concerned that initial
would be confused with the initial
keyword, which is an entirely separate concept.
Agree with @nt1m that this seems designed around browser engine internals rather than concepts web developers understand.
Agree that there should be a way to animate newly inserted elements that does not also animate them if they are present when the page loads.
Missing an actual definition for this @initial
rule that people started talking about at some point.
Yves: Definition in https://github.com/w3c/csswg-drafts/issues/8174
Lea: That's the one I was looking at. Discussion goes from :initial
to @initial
but I cannot see any proposal or strawman for the latter.
Yves: Would be good to have a concrete proposal for @initial
(or whatever name is chosen)
... WRT csswg-drafts/#8389, inert
CSS property seems useful, and explaining HTML inert
attribute in terms of that is good practice. Unfortunate it was resolved against, as now developers have no means of opting out of this behavior, but this is better than not having the behavior at all.
Hi @josepharhar,
@ylafon and I spent quite some time during our Tokyo F2F looking at the various issues, and the explainer.
Overall we like the direction that this is going. Designing a solution to this problem as small independent improvements on existing features that can together be leveraged for entry and exit animations is a good practice.
We also like that existing transition syntax could be leveraged to do the right thing, rather than introducing new syntax.
We see discussion went from :initial
to @initial
due to specificity issues (?), but we could not find a definition of what @initial
is/does. We are also concerned that the name will be confusing for authors, as initial
is an existing, unrelated concept in CSS (initial values).
Making transitions to display: none
inert seems preferable, though it is unfortunate the inert
property was resolved against, and thus authors can not opt out or use this behavior for other use cases.
For some of these issues (e.g. 6429) there seemed to be still active discussion after any resolutions, making us wonder if shipping this might be a little premature.
</blockquote> Comment by @LeaVerou Apr 19, 2023 (See Github)
Hi @josepharhar,
@ylafon and I spent quite some time during our Tokyo F2F looking at the various issues, and the explainer.
Overall we like the direction that this is going. Designing a solution to this problem as small independently useful improvements on existing features that can together be leveraged to solve the problem is a good practice.
We also like that existing transition syntax could be leveraged to do the right thing, rather than introducing new syntax.
We see discussion went from :initial
to @initial
due to specificity issues (?), but we could not find a definition of what @initial
is/does. We are also concerned that the name will be confusing for authors, as initial
is an existing, unrelated concept in CSS (initial values).
Making transitions to display: none
inert seems preferable, though it is unfortunate the inert
property was resolved against, and thus authors can not opt out or use this behavior for other use cases.
For some of these issues (e.g. 6429) there seemed to be still active discussion after any resolutions, making us wonder if shipping this might be a little premature.
Comment by @josepharhar May 31, 2023 (See Github)
we could not find a definition of what
@initial
is/does
Here is a spec PR which should make a clear definition: https://github.com/w3c/csswg-drafts/pull/8876
We are also concerned that the name will be confusing for authors, as initial is an existing, unrelated concept in CSS (initial values).
It was changed to @starting-style
based on additional discussion
For some of these issues (e.g. 6429) there seemed to be still active discussion after any resolutions, making us wonder if shipping this might be a little premature.
We just resolved on additional behavior details on https://github.com/w3c/csswg-drafts/issues/6429
Comment by @lilles Jun 22, 2023 (See Github)
The PR for @starting-style is now in css-transitions-2:
https://drafts.csswg.org/css-transitions-2/#defining-before-change-style-the-starting-style-rule
Comment by @nt1m Jun 22, 2023 (See Github)
I think one question I'd be interested in seeing answered regarding this new feature is why:
dialog {
@starting-style {
opacity: 0;
}
transition: opacity 0.4s;
}
is preferable over:
@keyframes fade-in {
0% { opacity: 0 }
}
dialog {
animation: fade-in 0.4s;
}
They both work and achieve the same use case, and the new syntax isn't that much shorter.
Comment by @flackr Jun 23, 2023 (See Github)
For the simple use case they indeed both work, however developers often prefer transitions for their ergonomic simplicity in dealing with arbitrary subsequent changes. For example, with the fade animation:
@keyframes fade-in {
0% { opacity: 0 }
}
dialog {
animation: fade-in 0.4s;
}
- Any subsequent changes to the opacity while it is animating in take effect immediately, even if
transition: opacity 0.4s;
is set. - If you hide the dialog while it is still progressing through the showing animation, a transition will implicitly reverse from the point it is currently at - and at the appropriate speed per css-transitions-3.1
These behaviors are often desirable and much harder to get right with animations. For example, I put together a demo showing the difference between naively using animations vs transitions for entry and/or exit: https://jsbin.com/coxewex/edit?html,css,output Note: Move the mouse out before the animation finishes to see the significant differences.
You can see with an animation in and transition out the transition is completely skipped if the animation hasn't finished yet, and if you use an animation in both direction then it's not easy to prevent it from playing from the shown state.
Comment by @nt1m Jun 24, 2023 (See Github)
This makes sense, thanks. I guess the other question I have now that we're talking about @keyframes is how both features interact together. What happens if someone uses animations and @starting-style
on the same element? or if they set animations in @starting-style
.
Comment by @LeaVerou Jun 24, 2023 (See Github)
This makes sense, thanks. I guess the other question I have now that we're talking about @Keyframes is how both features interact together. What happens if someone uses animations and
@starting-style
on the same element? or if they set animations in@starting-style
.
The same as any other time that transitions and animations are running at the same time?
Comment by @nt1m Jun 24, 2023 (See Github)
Ah right, need for think more before I write 😅. The reason this popped in my mind was that I could see sites using both @starting-style and @keyframes on the same element (not necessarily as intended).
Comment by @LeaVerou Dec 18, 2023 (See Github)
Hi there, quick question as we do some end-of-year housekeeping. We notice the title of this issue is "Entry and Exit Animations", but right now CSS only includes entry animations, and exit animations have been contentious. Is this meant as a design review for both, or just about @starting-style
?
Comment by @nt1m Dec 18, 2023 (See Github)
I think the exit bits are somewhat covered by the discrete transition stuff.
Comment by @LeaVerou Dec 18, 2023 (See Github)
I think the exit bits are somewhat covered by the discrete transition stuff.
Not sure I follow, could you please elaborate?
Comment by @nt1m Dec 18, 2023 (See Github)
This was about being able to do exit animations for display: none for most part (so from display: block to display: none), since it's the most common case for popovers. AFAIK, transition: display 1s allow-discrete, opacity 0.1s
covers this case. I don't think exit animations for element removal was ever a goal of this specific issue.
Comment by @josepharhar Dec 18, 2023 (See Github)
Exit animations can be done with transition-behavior:allow-discrete as Tim said. Here is a minimal example: https://jsfiddle.net/jarhar/cyugx34v/4/ The overlay property also allows these elements to stay in the top layer during their exit animation.
These have both been specced, have tests, and have been shipped in chrome: https://github.com/web-platform-tests/interop/issues/580 https://github.com/web-platform-tests/interop/issues/581
Discussed
Mar 1, 2024 (See Github)
[Discussed the two trigger moments for @starting-style. Peter to ask a question about the display:none case.]
Discussed
Aug 1, 2024 (See Github)
Dan: I think we need Lea here...
Discussed
Sep 1, 2024 (See Github)
JeffreyL: we were waiting on a plenary discussion but Lea thumbs-upped it.
Dan: can we close based on the text we wrote above?
closed
Discussed
Sep 1, 2024 (See Github)
Jeffrey: It's been a long time .. it's in "interop 2024"... agreement between 3 browser engines to focus on interop on certain features... no arch issues raised. Dbaron mentioned offline that he's not happy with some details but that's something CSS wg can focus on. so Nothing for us to do here.
Dan: I'm happy with that...
Dan: let's check with Lea before closing - we can close at plenary.
Yves: also - the issues raised in CSS wg for that were closed...
<blockquote>We see that the browsers have agreed to focus on implementing these features as part of Interop 2024. While some of the details may still not be optimal, we don't think there are any architectural concerns, and we think the CSSWG is the right place to continue refining the design, if necessary. Thank you for bringing us this review!
</blockquote>Closed as satisfied at plenary
Comment by @torgo Sep 12, 2024 (See Github)
As discussed in TAG calls this week: We see that the browsers have agreed to focus on implementing these features as part of Interop 2024. While some of the details may still not be optimal, we don't think there are any architectural concerns, and we think the CSSWG is the right place to continue refining the design, if necessary. Thank you for bringing us this review!
OpenedMar 29, 2023
こんにちは TAG-さん!
I'm requesting a TAG review of Entry and Exit Animations. I am using one TAG issue for these features because they are used together to accomplish an important use case.
Entry and Exit Animations is a set of CSS features which makes it possible to animate elements to and from
display:none
, and to animate elements entering and leaving the top layer, like<dialog>
and elements with thepopover
attribute.The CSS features include:
transition
property to animate discrete properties likedisplay
. (formerly https://github.com/w3ctag/design-reviews/issues/825) CSSWG issue: https://github.com/w3c/csswg-drafts/issues/4441display
property (formerly https://github.com/w3ctag/design-reviews/issues/824) CSSWG issue: https://github.com/w3c/csswg-drafts/issues/6429@initial
rule, which allows animations to start fromdisplay:none
. CSSWG issue: https://github.com/w3c/csswg-drafts/issues/8174overlay
property, which allows animations on elements entering or leaving the top layer. CSSWG issue: https://github.com/w3c/csswg-drafts/issues/8189@initial
rule: Not specced yetoverlay
property: Not specced yetFurther details:
We'd prefer the TAG provide feedback as (please delete all but the desired option):
💬 leave review feedback as a comment in this issue and @-notify [github usernames]