-
Notifications
You must be signed in to change notification settings - Fork 56
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
Entry and Exit Animations #829
Comments
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. 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 Making transitions to 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. |
Here is a spec PR which should make a clear definition: w3c/csswg-drafts#8876
It was changed to
We just resolved on additional behavior details on w3c/csswg-drafts#6429 |
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 |
I think one question I'd be interested in seeing answered regarding this new feature is why:
is preferable over:
They both work and achieve the same use case, and the new syntax isn't that much shorter. |
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;
}
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: 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. |
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 |
The same as any other time that transitions and animations are running at the same time? |
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). |
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 |
I think the exit bits are somewhat covered by the discrete transition stuff. |
Not sure I follow, could you please elaborate? |
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, |
Exit animations can be done with transition-behavior:allow-discrete as Tim said. Here is a minimal example: https://jsfiddle.net/jarhar/cyugx34v/4/ These have both been specced, have tests, and have been shipped in chrome: |
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! |
こんにちは 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 Transitions on specified discrete properties #825)
CSSWG issue: [css-transitions-2] Start transitions on discrete animation types w3c/csswg-drafts#4441
display
property(formerly Display and content-visibility animations #824)
CSSWG issue: [css-display] Why is display listed as not animatable instead of animation type: discrete? w3c/csswg-drafts#6429
@initial
rule, which allows animations to start fromdisplay:none
.CSSWG issue: [selectors-4] Add syntax to establish before-change style for css-transitions on new elements. w3c/csswg-drafts#8174
overlay
property, which allows animations on elements entering or leaving the top layer.CSSWG issue: [css-animations-2, css-transitions-2] Entry and exit animations for top-layer elements w3c/csswg-drafts#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]
The text was updated successfully, but these errors were encountered: