Skip to content

[css-view-transitions-2] Allow changing types using JS after (MPA) transition started? #9542

@noamr

Description

@noamr

Currently we're only allowing to set the transition types at startViewTransition, and they can get changed when revealing the new document in a cross-document view transition.

But perhaps we can allow the author to read or change the types programmatically, as a DOMTokenList on the VT object?
Something like this:

document.addEventListener("pagereveal", event => {
  const {viewTransition} = event;
  const hasSlideIn = viewTransition.typeList.has("slide-in");
  if (heroImage.loaded) {
     viewTransition.typeList.toggle("expand-hero", true);
  }
});

Note that this is possible to do today using the CSSOM, but not dynamically while the VT is already running.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions