Re: [csswg-drafts] [css-view-transitions-1] Should the DOMChangeCallback be posted as a task from skip transition steps? (#7904)

> What adding a postTask here would cause is a potential flicker. you'd have a moment where on one hand rendering is allowed ("transition suppressing rendering" is off), and OTOH the update callback wasn't called.

Just reiterating the case which could potentially flicker:

```js
function cancelTransition(transition) {
  // Author assumes that update callback was dispatched synchronously here.
  transition.skipTransition();

  // Author updates DOM assuming the update callback was already run.
  // This causes a flicker when the update callback is dispatched.
  updateDOMAfterTransition();
}
```

The update callback itself is async. In the case above, even if dispatched the update callback synchronously in skipTransition, the author still has to ensure its completed before running `updateDOMAfterTransition`. They can use `updateCallbackDone` promise for it.

```js
function cancelTransition(transition) {
  transition.skipTransition();
  transition.updateCallbackDone.then(updateDOMAfterTransition);
}
```

Also note that we don't want to suppress rendering until the callback finishes if the transition was skipped. We don't know if the author will make the updateDOM callback a no-op in this case.

-- 
GitHub Notification of comment by khushalsagar
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7904#issuecomment-1540588665 using your GitHub account


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

Received on Tuesday, 9 May 2023 17:34:09 UTC