Skip to content
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

Transitions do not work if the "delay" prop is greater than "duration" #251

Open
Matix-Media opened this issue Mar 24, 2023 · 2 comments
Open
Labels
bug Something isn't working

Comments

@Matix-Media
Copy link

Actual behavior

The Transitions do not play, the component gets rendered 100 ms after all the other components but the transition does not get played (component has attribute appear)

Expected behavior

Play transition on appear

Steps to reproduce

  1. Use Vue 3
  2. Add transition
  3. add appear

Environment

  • Device: Desktop
  • OS: Windows 11
  • Browser: Chrome 111

Additional context

<script setup>
import { TransitionFade } from "@morev/vue-transitions";
</script>
<template>
            <transition-fade appear :delay="5000">
                <img
                    class="logo"
                    src="@/assets/logos/java-edition.webp"
                    alt="Minecraft: Java Edition"
                />
            </transition-fade>
</template>

Question: Is it required to call app.use even when using the components via import?

Possible solution

No response

@Matix-Media Matix-Media added the bug Something isn't working label Mar 24, 2023
@MorevM
Copy link
Owner

MorevM commented Mar 24, 2023

Good day @Matix-Media,

First, to answer to your question: no, you can skip the app.use() call and use the transition components via direct import.

Secondly, I can reproduce the problem, the only thing is that happens because of delay property, not appear.
You can check that it works as intended in case like

<transition-fade appear :duration="2000">
  <div style="width: 200px; height: 200px; background-color: red;"></div>
</transition-fade>

The problem occurs if the delay property is used and if the delay is greater than (or equal to) the duration.


I'm very busy right now, and besides, it's not as easy to solve as it may seem.
I'll take a look, but I'm pretty sure it will be in about two or three weeks.

For now, as a workaround, I recommend not to use the delay property and create an explicit trigger:

<template>
  <transition-fade>
    <div v-if="isShown" style="width: 200px; height: 200px; background-color: red;"></div>
  </transition-fade>
</template>

<script setup>
  import { ref, onMounted } from 'vue';
  import { TransitionFade } from '@morev/vue-transitions';

  const isShown = ref(false);
  onMounted(() => {
    setTimeout(() => (isShown.value = true), 5000);
  });
</script>

I'll let you know when the problem is gone. :)

@MorevM MorevM changed the title Transitions not working Transitions do not work if the "delay" prop is greater than "duration" Mar 24, 2023
@Matix-Media
Copy link
Author

Thank you for your fast reply. I can make it work without the delay. 👍

@MorevM MorevM mentioned this issue Jan 17, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants