[csswg-drafts] [css-view-transitions] State management seems broken in the spec (#10822)

emilio has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-view-transitions] State management seems broken in the spec ==
Per spec, this snippet calls the transition callback twice:

```js
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](https://drafts.csswg.org/css-view-transitions-1/#call-the-update-callback) says:

  * Otherwise, set callbackPromise to the result of [invoking](https://webidl.spec.whatwg.org/#invoke-a-callback-function) transition’s [update callback](https://drafts.csswg.org/css-view-transitions-1/#viewtransition-update-callback).
  * If transition’s [phase](https://drafts.csswg.org/css-view-transitions-1/#viewtransition-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

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10822 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 2 September 2024 22:18:06 UTC