-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
cssStuff related to Svelte's built-in CSS handlingStuff related to Svelte's built-in CSS handling
Description
Describe the bug
Given this style block:
<style>
@starting-style{
.card{
opacity: 0;
height: 0;
}
}
.card {
background-color: orange;
max-width: max-content;
padding: 1rem;
border-radius: 1rem;
display: grid;
margin: auto;
transform-origin: bottom;
overflow: hidden;
transition: opacity 1s, display 1s, height 1s;
transition-behavior: allow-discrete;
}
</style>Svelte outputs the following CSS:
@starting-style{}.card.svelte-1xboevw{background-color:orange;max-width:max-content;padding:1rem;border-radius:1rem;display:grid;margin:auto;transform-origin:bottom;overflow:hidden;transition:opacity 1s, display 1s, height 1s;transition-behavior:allow-discrete}Note the empty ruleset within the @starting-style block. This rule is required to enable discrete entry transitions e.g. from display: none. Ideally, Svelte should be adding a scoped .card.svelte-[hash] rule within that block to the stylesheet.
Moreover, supporting this declaration would also likely help unlock more performant transitions directives provided by Svelte itself, without the need for JS functions.
Possibly related:
#8587
Reproduction
Not Working (Svelte)
https://svelte.dev/repl/74f096b3e2884455b47b9e6a2e6b24e9?version=4.2.1
Working (Codepen)
https://codepen.io/jrmoynihan/pen/jOXxeWG?editors=1111
Logs
No response
System Info
Chrome 117+, MacOS, Svelte 4.2.1Severity
annoyance
Serator, ZachSaucier, patricknelson and edding-3000
Metadata
Metadata
Assignees
Labels
cssStuff related to Svelte's built-in CSS handlingStuff related to Svelte's built-in CSS handling