Re: [csswg-drafts] [css-view-transitions-2] Syntax for customizing transitions based on their type (#8960)

> * The type should be one of the params to the `@view-transition` config. This helps authors use the same CSS for same-document vs cross-document transitions. For example, a site might choose between the 2 for the same navigation (@bramus had an example for such a pattern).

I'd like to clarify a couple of things here:
1. We're talking about MPA transitions, so when you say the type should be reflected in `@view-transition` config, this has no bearing on transitions initiated with `startViewTransition`. If the latter has a type specified in it, which is also a part of this issue, then it affects that transition.
1. The above implies that `@view-transition { type: foo }` has no effect when the transition is initiated with `startViewTransition`. Since both these types will be affecting the same pseudo class activation, we need to be clear about this in the spec. The corollary to this is likely that we won't be able to add a `script` value to the opt-in property, since it would only add confusion about opt-in affecting script. This also aligns with several opinions we've heard comparing this to web animations: CSS can't disable those. 

I'd like to propose a syntax for `startViewTransition`:
* `startViewTransition((UpdateCallback or StartViewTranstionDictionary))` where `UpdateCallback` is the existing syntax, and `StartViewTransitionDictionary` is a dictionary that includes `updateCallback` -- an `UpdateCallback` to use -- and `type` -- a `DOMString` identifying the type of the transition (bikeshedding welcome!). The union should already be distinguishable based on the union type selection algorithm in WebIDL, but I have a PR here to clarify: https://github.com/whatwg/webidl/pull/1353

When the transition starts, the `type` if specified causes the following pseudo-class to be applied to the `:root` element:
* `:view-transition-type(ident)`. This is applied to the `:root` element with the same `ident` as the `type` dictionary value given to the `startViewTransition` call.

Note that I'm explicitly not mentioning `@view-transition` and interaction between two different documents here, but the assumption is that the two approaches work well together

Note that this can be extended to scoped transitions as mentioned above, since the pseudo class can then be applied to the root of the scoped transition, not necessarily `:root`


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


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

Received on Monday, 21 August 2023 19:28:31 UTC