Skip to content

[css-view-transitions] State management seems broken in the spec #10822

Closed

Per spec, this snippet calls the transition callback twice:

document.startViewTransition(async function() {
  console.log("cb");
  document.startViewTransition() => {});
});

This is in fact what happens in Safari TP, and in my experimental Firefox implementation.

This is because call the update callback says:

  • Otherwise, set callbackPromise to the result of update callback.
  • If transition’s phase is not "done", then set transition’s phase to "update-callback-called".

But that's already too late, because if something (like startViewTransition) skips the transition, the state is not "update-callback-called".

It seems for this specific case, just swapping those two steps should work. But might be worth looking at similar things in the spec.

cc @nt1m

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

      Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant