Re: [csswg-drafts] [css-view-transitions-2] Syntax for navigation-matching (#8925)

> @jakearchibald before going into the exact syntax, I want to make sure we're all on the same page about the following:
> 
> * Not allowing media queries on the old Document to depend on any state parsed from the new Document. So something like this on the old Document:

Right, it should use the initiated navigation's URL in the old document, and the actual URL in the new document. Authors should be aware of this.

> * Extending this approach to SPA transitions:
>   
>   * It's better if we can enable these queries for same-document navigations, irrespective of whether there is a transition. We'll need to think through the lifetime of the queries with respect to the navigation lifecycle but I don't see the advantage of limiting it to navigations which have a ViewTransition (unless constrained by implementation).
>   * On the flip side, if the transition is not associated with a navigation, then does it make sense to enable these queries? They would be tightly coupled with navigation concepts. We could have the author specify parameters that identify a navigation (url, type) in the call to startViewTransition but then it becomes ambiguous which state should we be using for these queries. For example, does the vt-old-page value come from the previous navigation entry's url or what the author passed in the startViewTransition call?
>     We can have a think about this more but are there use-cases where an author would want this functionality but doesn't want to trigger a same-document navigation?

I am thinking that these concepts would be automatic for MPA navigations, and at first manual for SPA navigations, with an option to enable automatic navigation detection later when we allow declarative SPA transitions (something I'm really keen to do in the future). The latter would require careful integration with the timings of the navigation API,

Perhaps for SPA transitions we don't even need to pass the URLs, but rather just the navigation names, e.g.
```js
startViewTransition({done: () => {...}, navigations: ["foo-to-bar"]})
```



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


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

Received on Saturday, 10 June 2023 07:32:45 UTC