Skip to content

Allow deferring commit of a same-origin cross-document navigation #11819

@noamr

Description

@noamr

What problem are you trying to solve?

When switching between pages, the old page might want to customize the navigation experience, e.g. by displaying an exit animation or asynchronously preparing a view-transition.

What solutions exist today?

The developer can intercept the navigation (e.g. navigateEvent.intercept({precommitHandler}), and start a new navigation when they're ready.

However, this would create a slow end result as the cross-document navigation initiation is delayed.

How would you solve it?

There are two options as to how to resolve this:

  1. A generic pageSwapEvent.waitUntil(promise), allowing the developer to defer commit as much as they want.
  2. Provide some heuristics to particularly allow some animations to run until finish before committing.

Anything else?

This is different from #10997, where the "unload" actions are also valid for cross-origin navigations (e.g. an IndexedDB transaction). This is specific for in-app (same-origin) navigation customization.

cc @jakearchibald

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions