[csswg-drafts] [css-view-transitions-2] Declaring when an MPA transition can start (#8681)

jakearchibald has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-view-transitions-2] Declaring when an MPA transition can start ==
I don't think MPA transitions should delay the swap from the old to new document by default. Instead, the transition should happen on first render. This means, when the transition starts, the page may not have fully parsed, and things like images may not have loaded.

With SPA, you can preload assets before calling `startViewTransition`. With MPA, you can use [prerender](https://developer.chrome.com/blog/prerender-pages/), but you don't get feedback when the prerender is 'ready'.

[Blocking attributes](https://html.spec.whatwg.org/multipage/urls-and-fetching.html#blocking-attributes) can be used by the incoming page to delay the document swap. However, these attributes currently only apply to script/stylesheets. We could expand the set of elements they apply to, such as images and preload. We could add a special blocking value "`view-transition`", so the blocking only applies if a view transition is being attempted.

We could also allow first render to be delayed by JavaScript:

```js
document.addEventListener('crossdocviewtransition', (event) => {
  event.waitUntil(promise);
});
```

Although we'd want to avoid infinite delays, like we already do with `startViewTransition`.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8681 using your GitHub account


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

Received on Tuesday, 4 April 2023 12:32:17 UTC