Re: [csswg-drafts] [view-transitions-2] Allow styling based on navigation/transition state (#10434)

> Are SPAs doing it by keeping this in user-land?

I can say I have this feature of keeping track of played animations that needs to not be re-played, which I don't wish to keep supporting since it's not MPA-compat.

> The idea seems reasonable to me and should be trivial to add for cross-document navigations. Its the CSS equivalent of [NavigationActivation](https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigation-activation-interface) so we should probably go for a syntax that allows adding other stuff from NavigationActivation to CSS.

I guess this state currently isn't just about whether there was a cross-docuemnt transition or not, so perhaps extending this further to the concept of activation could also make sense, but I suspect the need is more urgent when a VT is used.

> But I'm not sure how to reason about it for the SPA case.

If you're on same document, replacing DOM, and applying a VT, it would be nice to declaratively also style elements differently if they were replaced.

> So this is somethlng like having CSS instead of the following line?
>
> addEventListener("pagereveal", e => 
    document.documentElement.classList.toggle("has-view-transition", !!e.viewTransition)
 );`

Exactly!

-- 
GitHub Notification of comment by ydaniv
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10434#issuecomment-2162751356 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 12 June 2024 11:16:21 UTC