Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Explore how to integrate the new View Transitions API #178

Closed
luisherranz opened this issue Mar 13, 2023 · 2 comments
Closed

Explore how to integrate the new View Transitions API #178

luisherranz opened this issue Mar 13, 2023 · 2 comments

Comments

@luisherranz
Copy link
Member

Let's explore how to integrate the new View Transitions API!

@DAreRodz played with it in this branch, but everything was hardcoded. Let's see what tools we can build to make using this API a breeze for theme creators.


About running document.startViewTransition with client-side navigation:

  • Should the router support it?

    • Should it be configured using the router's state? Like:

      store({
        state: {
          router: {
            viewTransitions: true,
          },
        },
      });
    • Should it be a <meta> tag like the client-side navigation?

      <meta itemprop="wp-view-transitions" content="active">
    • Should it be the same <meta> tag as the client-side navigation?

      <meta itemprop="wp-interactivity" content='{ "clientSideNavigation": true, "viewTransitions": true }'>
    • Should the client-side navigation be a state configuration instead of a <meta> tag?

      store({
        state: {
          router: {
            clienSideNavigation: true,
            viewTransitions: true
          },
        },
      });
    • Can we make it so document.startViewTransition is not hardcoded into the router, and instead is injected as external functionality? (make the router "extensible")

About setting view-transition-name dynamically:

  • Can we create a directive to set it dynamically right before the user navigates?

    <a
      class="wp-block-group"
      data-wp-link
      data-wp-view-transition-name="featured-image"
    >
      <h3 class="wp-block-header">Some Post Title</h3>
      <img class="wp-block-image" src=".../featured-image.jpg" />
    </a>
  • Should it be part of `wp-link'?

    <a
      class="wp-block-group"
      data-wp-link='{ "prefetch": true, "viewTransitionName": "featured-image" }'
    >
      <h3 class="wp-block-header">Some Post Title</h3>
      <img class="wp-block-image" src=".../featured-image.jpg" />
    </a>
  • If this needs to match the CSS of the theme, how can a theme "inject" this directive in the correct place of the HTML?

  • Should blocks support it by default? (configurable in the Editor)


Other questions?

@luisherranz
Copy link
Member Author

luisherranz commented Jun 15, 2023

@luisherranz
Copy link
Member Author

luisherranz commented Jun 30, 2023

The Astro team is working on an API to do client-side navigation. It has directives for the transitions, so we should take a look and check if some of their ideas are good and could be applied here as well: withastro/roadmap#607

@WordPress WordPress locked and limited conversation to collaborators Jul 27, 2023
@luisherranz luisherranz converted this issue into a discussion Jul 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant