Re: [csswg-drafts] [css-view-transitions-2] Script event on new Document for cross-document ViewTransitions (#8805)

For the purpose of the F2F, summarizing current thinking about this.
The use-cases this comes to address are:
- skipping an inbound cross-document view-transition
- Programmatically animating an inbound cross-document view-transition with the web animation API
- Responding to animation states, e.g. show something only when the animation is done or only once it's started.

A design principle here is to keep consistency, both with view-transitions-1 and with other web features.

There are several alternative on how to achieve this:
1. As originally proposed in this issue, have an event that's fired only when there is an inbound view transition, e.g. `inboundviewtransition` or `crossdocumentviewtransition`.
2. Always fire an event when a document is about to be presented (`reveal`), and include an optional `ViewTransition` object as a property of that event. This has the advantage of being compatible with css-view-transitions-1, and also the `reveal` event might be useful for things other than view-transitions so why not.
3. Send separate events for `start`, `ready` and `finished`, without a `ViewTransition` object. This is compatible with e.g. how mouse/touch events work, and avoids the need to add a listener only in order to register a promise, but it's not compatible with css-view-transitions-1 where the `ViewTransition` object is promise-based.

Note that  as the OP states, `updateCallbackDone` is irrelevant for cross-document view transitions. The current spec proposal is to simply have it as a resolved promise rather than have different IDL types and inheritance.

The current [spec](https://drafts.csswg.org/css-view-transitions-2) goes with option (2), as it seems to be the most compatible with VT-1.

See [example in the draft spec](https://drafts.csswg.org/css-view-transitions-2/#example-667bf2a6).







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


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

Received on Monday, 17 July 2023 10:14:47 UTC