Skip to content

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

Closed

Description

@emilio

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 invoking transition’s 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 @khushalsagar @vmpstr @mattwoodrow @nt1m

Activity

  1. emilio commented on Sep 2, 2024

    @emilio
    CollaboratorAuthor

    cc @noamr too.

  2. noamr commented on Sep 3, 2024

    @noamr
    Collaborator

    Good catch, I think swapping them should be sufficient, as the previous steps in call the update callback are just setup and don't have any effect.

  3. emilio commented on Sep 3, 2024

    @emilio
    CollaboratorAuthor

    Yeah at first I was more concerned about this being a general problem, but this is the only place where I found the issue so far.

  4. added a commit that references this issue on Sep 3, 2024
    5d32091
  5. nt1m commented on Sep 3, 2024

    @nt1m
    Member

    I'm fixing this in WebKit with a WPT: WebKit/WebKit#33091

    I'm not sure the exact wording of the current spec PR is right though (I commented there already)

  6. 2 remaining items

  7. added a commit that references this issue on Sep 6, 2024
    86f20cc
  8. moved this to TPAC/FTF agenda items in CSSWG Agenda TPAC 2024on Sep 13, 2024
  9. moved this from TPAC/FTF agenda items to Regular agenda items in CSSWG Agenda TPAC 2024on Sep 13, 2024
  10. moved this from Regular agenda items to Friday afternoon in CSSWG Agenda TPAC 2024on Sep 16, 2024
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