Skip to content

Conversation

noamr
Copy link
Collaborator

@noamr noamr commented Sep 20, 2023

As per resolution at TPAC, adding a concept of "active types" to a view transition, with an active-view-transition pseudo-class that matches the root element if it has an active view transition that matches the list of active types.

To set the active types, startViewTransition now accepts options, like startViewTransition(update, types: ["slide", "reverse"]})

Closes #8960

@noamr
Copy link
Collaborator Author

noamr commented Sep 27, 2023

@khushalsagar @vmpstr ping?

noamr and others added 3 commits September 27, 2023 20:48
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>

<div algorithm="start-vt-with-options">
The [=method steps=] for <dfn method for=Document>startViewTransition(|options|)</dfn> are as follows:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the comment above, these steps should also handle both situations by deferring to L1's algorithms as appropriate

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

noamr and others added 3 commits September 28, 2023 18:02
Co-authored-by: vmpstr <vmpstr@chromium.org>
Co-authored-by: vmpstr <vmpstr@chromium.org>

partial interface Document {

ViewTransition startViewTransition(optional (UpdateCallback or StartViewTransitionOptions)? callbackOrOptions = null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this IDL to say "callback or options"? L1 declares the API which only takes a callback : https://drafts.csswg.org/css-view-transitions-1/#additions-to-document-api. So if in L2 the IDL adds a new API which is

startViewTransition(StartViewTransitionOptions options = null);

Would that be equivalent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't have overloads like this in WebIDL (or in javascript, for that matter). The new method shadows the previous one in a way, but we make sure it's compatible.
Adding startViewTransition(StartViewTransitionOptions options = null) would shadow the L1 function and not allow using a callback argument.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I was just playing around with the implementation and I think this is also not allowed due to the last point here:
https://webidl.spec.whatwg.org/#idl-nullable-type

The inner type must not be:
...

I don't quite understand the non-normative justification for this rule, but I also think that we can just make the union non-nullable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically something like this might work

ViewTransition startViewTransition((UpdateCallback or StartViewTransitionOptions?) callbackOrOptionsOrNull);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Member

@khushalsagar khushalsagar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % vmpstr.

Copy link
Member

@vmpstr vmpstr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@vmpstr vmpstr merged commit 25c0f81 into w3c:main Oct 11, 2023
@noamr noamr deleted the vt2-transition-types branch October 11, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[css-view-transitions-2] Syntax for customizing transitions based on their type
3 participants