From 45ecba800c974ec752a0103424403e19971c0708 Mon Sep 17 00:00:00 2001 From: Martin Trapp <94928215+martrapp@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:28:21 +0100 Subject: [PATCH] put CSS for exit animations on all potential next pages --- src/content/docs/tips/css.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/tips/css.mdx b/src/content/docs/tips/css.mdx index 607640e..5a158cc 100644 --- a/src/content/docs/tips/css.mdx +++ b/src/content/docs/tips/css.mdx @@ -31,7 +31,7 @@ This might come as a surprise, but it's simple to explain: Besides defining view The reason for this is that the animations are triggered by the appearance of the view transition pseudo-elements on the `:root` element of the new page. At that moment, only the styles from the new page are available. -While it seems logical, it's still somewhat counterintuitive that the CSS for an exit animation for an element that only exists on the old page needs to be defined on the new page. But keep in mind, that it is not the old element that is animated, but the _image_ of the old element that has been inserted as a pseudo-element on the new page. +While it seems logical, it's still somewhat counterintuitive that the CSS for an exit animation for an element that only exists on the old page needs to be defined on **all the page** the user can navigate to, including for example those reachable from a global navigation bar if your site features one. This might help you: keep in mind, that it is not the old element that is animated, but the _image_ of the old element that has been inserted as a pseudo-element on the new page. If you're accustomed to building with components, it might not always be clear which page a component will end up on and where the corresponding CSS should be placed. Additionally, the requirement that view transition names must be unique on a page makes you reconsider whether it's wise to hardcode view transition names inside reusable components. But that is not much different from using `id` attributes. -- knotmirror 0.0.1