Skip to content

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

Closed
@jakearchibald

Description

@jakearchibald

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, but you don't get feedback when the prerender is 'ready'.

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:

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions