Skip to content

Support enter/exit transitions #2078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DustinJSilk opened this issue Nov 10, 2022 · 3 comments
Closed

Support enter/exit transitions #2078

DustinJSilk opened this issue Nov 10, 2022 · 3 comments
Labels
COMP: runtime STATUS-1: needs triage New issue which needs to be triaged TYPE: enhancement New feature or request

Comments

@DustinJSilk
Copy link
Contributor

DustinJSilk commented Nov 10, 2022

Is your feature request related to a problem?

Qwik doesn't have any first class support for transitioning elements when they are created or destroyed.
Animating a component into view, or between states, can be done using an eager useClientEffect$.

The difficulty is when an element is destroyed; it's not possible to keep the element in the DOM until the animation is complete.

Describe the solution you'd like

SolidJS allow CSS animations with a Transition element:

<Transition name="slide-fade">
  {show() && (
    <div>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris
      facilisis enim libero, at lacinia diam fermentum id. Pellentesque
      habitant morbi tristique senectus et netus.
    </div>
  )}
</Transition>

Svelte has a nice API using html attributes:

{#if visible}
  <p transition:fly="{{ y: 200, duration: 2000 }}">
    Flies in and out
  </p>
{/if}

Describe alternatives you've considered

To animate out an element:

  • I've tried returning an async function from a useWatch and useClientEffect but the element will still be destroyed immediately.
  • I was also unable to duplicate the element to inject it back into the dom and manually destory it after the animation completes. But even if I could get this working, an issue would occur when you could have multiple copies of the element if it were to toggle fast enough.

Additional context

No response

@DustinJSilk DustinJSilk added TYPE: enhancement New feature or request STATUS-1: needs triage New issue which needs to be triaged labels Nov 10, 2022
@manucorporat manucorporat added this to the BACKLOG: Post v1.0 milestone Nov 28, 2022
@GrandSchtroumpf
Copy link
Contributor

This is not specific to qwik but in Chromium based browser you can use the view transition API to achieve that :
https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API

@mhevery
Copy link
Contributor

mhevery commented Aug 28, 2023

@wmertens
Copy link
Member

wmertens commented Mar 6, 2024

I'd like to merge this into QwikDev/qwik-evolution#55 since we're leaning towards only using the view transitions API, and that's what Qwik UI is using too.

@wmertens wmertens closed this as not planned Won't fix, can't repro, duplicate, stale Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP: runtime STATUS-1: needs triage New issue which needs to be triaged TYPE: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants