Re: [csswg-drafts] [css-view-transitions-1] Handling DOM updates when a transition's animation is reverse back to start/canceled (#7957)

Ok. I'd be supportive of an API to reverse the transition to the old state. The assumption being that we don't need to re-snapshot anything since the old state should be identical to the snapshots we cached. Just need to ensure that the developer doesn't switch the DOM back to the old state until the reverse animations are done, since until then we're using the DOM for live snapshots of the current state.

The pattern for when it's ok to update the DOM back to the old state is:
* Use the finished promise:
   ```js
     transition.reverse();
     transition.finished.then(updateDOMToOldState);
   ```
* Add it to the API
   ```js
      transition.reverse(updateDOMToOldState);
   ```

I think the `finished` promise should still resolve. The reverse API simply changes the notion of what the end state is. And if that's the case then option 1 is simpler. If the developer keeps calling reverse multiple times then we'd keep flipping between going forwards/backwards? :)

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


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

Received on Monday, 31 October 2022 16:18:36 UTC