Re: [csswg-drafts] [css-view-transitions-2] Behiavor of mismatching types between old and new document (#9526)

I'll add my thoughts with the disclaimer that I'm just now trying to catch up on earlier discussion and might have missed some discussion or use cases.

My interpretation of type is that it tags a _transition_ (e.g. type `StreamToItem`), rather than a page, so it doesn't really make sense to me that B would be setting a type since the transition is already created. i.e. the author already has all the context necessary on A (they know: A, A's state, and B) and A has been captured with the given type which B cannot change.

So there's an additional option to consider:

5. Apply only the type specified in the old document: `@view-transition { type: foo }` on a page A applies the type `foo` both on the outgoing and incoming pages but only for transitions _initiated_ from page A; It isn't applied to transitions where A is the incoming page.

This means authors don't have to do from-URL matching to deduce an incoming type and also corresponds to the SPA `startViewTransition` model where the type is specified only on initiation.

However, I've since seen [this comment](https://github.com/w3c/csswg-drafts/issues/8960#:~:text=Another%20option%20is%20to%20let%20the%20old%20Document%20be%20the%20decider%20but%20that%27s%20bad%20if%20the%20new%20Document%20chooses%20a%20different%20transition%20based%20on%20load%20state%20(transition%20to%20content%20if%20cache%20hit%20vs%20a%20loading%20screen).) rebutting this. i.e. B can have transition-affecting state that A may not know about (e.g. cache hit vs. loading page).

If that is a legit use case then I feel like it's a point in favor of option 2 (union). In that case, you still get the benefit of the above model where A defines the transition type which is usable on B, but B can override it, assuming additional types add specificity:

```css
/* On page B */
@view-transition {
  navigation: auto;
  type: LoadingPage
}

html:active-view-transition(StreamToItem) ::view-transition-group(item) { /* Animate In */ } 
html:active-view-transition(NotificationsToItem) ::view-transition-group(item) { /* Animate In Differently */ }

/* On loading page and don't have an item yet so do something else.
   Applies because additional parameters add specificity */
html:active-view-transition(StreamToItem,LoadingPage) ::view-transition-group(item),
html:active-view-transition(NotificationsToItem,LoadingPage) ::view-transition-group(item) { ... }
```

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


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

Received on Friday, 10 November 2023 22:55:26 UTC