You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that adding scoping this ::view-transition-old to a unique class (here .svelte-1qc54kw) is incorrect, since these pseudo-elements are always placed at the root of the document.
Prior Art
The counterpart without the :only-child tree-structural pseudo-class does indeed consider the selector to be "global-like", i.e.:
In there, you can see that the JS "editor" (in green) doesn't use the slide-in or slide-out animations when being added/removed to the DOM when the corresponding checkbox is toggled; it'll only transition is a "cross-fade". The other two will work as expected.
For instance, specifying a tree-structural pseudo-class to
`::view-transition-new` should still constitute a valid global-like
selector.
Fixessveltejs#15312
ccjmne
added a commit
to ccjmne/svelte
that referenced
this issue
Feb 16, 2025
For instance, specifying a tree-structural pseudo-class to
`::view-transition-new` should still constitute a valid global-like
selector.
Fixessveltejs#15312
For instance, specifying a tree-structural pseudo-class to
`::view-transition-new` should still constitute a valid global-like
selector.
Fixessveltejs#15312
ccjmne
changed the title
Appending tree-structural pseudo-classes to ::view-transition shouldn't compile into a scoped selector
Appending tree-structural pseudo-classes to ::view-transition shouldn't compile to a scoped selector
Feb 16, 2025
Issue
This code:
... compiles to:
I believe that adding scoping this
::view-transition-old
to a unique class (here.svelte-1qc54kw
) is incorrect, since these pseudo-elements are always placed at the root of the document.Prior Art
The counterpart without the
:only-child
tree-structural pseudo-class does indeed consider the selector to be "global-like", i.e.:... compiles to:
Motivation
The documentation for the view-transition API at developer.chrome.com employs this syntax (adding
:only-child
) to distinguish between the cases where:-new
and-old
, when it'll only play the "update" animation;-new
or-old
is the:only-child
of that-pair
, when it'll play a fade-in/out animation.Reference: https://developer.chrome.com/docs/web-platform/view-transitions/same-document#view-transition-class
Specifically, see the demonstration available there: https://view-transitions.chrome.dev/cards/spa/
Work-Around
Use a
:global(...)
selector:Reproduction
I created a small app on Svelte's Playground to illustrate that issue.
https://svelte.dev/playground/dc174a9d91fd44179a48281446f1bbc0?version=5.20.1
In there, you can see that the JS "editor" (in green) doesn't use the
slide-in
orslide-out
animations when being added/removed to the DOM when the corresponding checkbox is toggled; it'll only transition is a "cross-fade". The other two will work as expected.The only difference is in this excerpt:
Severity
annoyance
The text was updated successfully, but these errors were encountered: