Skip to content

Support for Chrome's Document Transitions #5689

@ramiroaisen

Description

@ramiroaisen

Describe the problem

This issue is to track support for Chrome's Document Transitions API AKA Shared Element Transitions on navigations inside sveltekit

More info about Chrome's feature and status can be found here:

https://github.com/WICG/shared-element-transitions/blob/main/developer-guide.md
https://github.com/WICG/shared-element-transitions/blob/main/explainer.md
https://chromestatus.com/feature/5193009714954240

The only reason this is hard to implement in userland is because the time between beforeNavigate and afterNavigate could be considerable considering sveltekit may have to make an http request in the middle of it or importing other modules.

Describe the proposed solution

Provide hooks like afterNavigate and beforeNavigate but that triggers just before and after the dom updates.
That way the user can call document.createDocumentTransition on their own

Alternatives considered

Provide a property in the sveltekit.config.js file to optionally enable this feature.
This way is the simple one, sveltekit just have to call document.createDocumentTransition before new navigations updates the dom, update the dom and then resolve the promise.

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions