-
Hello! I'm trying to animate a Radix Popover with Motion Vue, and it's working perfectly when opening it, but not when closing it. I got the following component: <script setup lang="ts">
import { Popover } from 'radix-vue/namespaced';
import { AnimatePresence, Motion } from 'motion-v';
</script>
<template>
<div class="px-4">
<Popover.Root>
<Popover.Trigger class="cursor-pointer">
Toggle popover
</Popover.Trigger>
<Popover.Portal>
<AnimatePresence>
<Popover.Content as-child class="px-4 py-2 bg-pink-400">
<Motion
:initial="{ opacity: 0, scale: 0.95 }"
:animate="{ opacity: 1, scale: 1 }"
:exit="{ opacity: 0, scale: 0.95 }"
:transition="{ duration: 0.3, ease: 'easeInOut' }"
>
I'm a popover!
</Motion>
</Popover.Content>
</AnimatePresence>
</Popover.Portal>
</Popover.Root>
</div>
</template> Is there something I am doing wrong? |
Beta Was this translation helpful? Give feedback.
Answered by
rick-hup
Feb 16, 2025
Replies: 1 comment 4 replies
-
Since Popover.Content renders a data-radix-popper-content-wrapper as the parent element of Motion for positioning, AnimatePresence component cannot track the unmounting of the Motion component. We will handle this case in the future. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, to implement exit animations, you might need to structure your code like this: