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

[Bug]: Popover has no animation on exit using Motion Vue #1663

Closed
MickL opened this issue Feb 27, 2025 · 2 comments
Closed

[Bug]: Popover has no animation on exit using Motion Vue #1663

MickL opened this issue Feb 27, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@MickL
Copy link

MickL commented Feb 27, 2025

Environment

Developement/Production OS: macOS
Node version: bun 1.2.3
Package manager: bun 1.2.3
Radix Vue version: 2.0.0
Vue version: 3.5.13

Link to minimal reproduction

https://github.com/MickL/reka-popover-bug

Steps to reproduce

Using Motion Vue it has a enter animation but no exit animation:

<template>
   <PopoverRoot v-model:open="isOpen">
      <PopoverTrigger class="bg-white shadow-sm p-4 bg-gray-100 rounded-full">
        Push me
      </PopoverTrigger>
      <PopoverPortal>
        <AnimatePresence>
          <PopoverContent
            as-child
            :side-offset="10"
            class="bg-white shadow-sm p-4 rounded-lg max-w-xs origin-top-left"
            align="start"
          >
            <Motion
              :initial="{ opacity: 0, scale: 0 }"
              :animate="{ opacity: 1, scale: 1 }"
              :exit="{ opacity: 0, scale: 0 }"
            >
              <p>
                Lorem ipsum dolor sit amet, consectetur adipisicing elit.
                Adipisci animi, asperiores aut delectus dolore, eaque est et ex
                facere ipsum iste maiores officia provident quidem ratione, rem
                sit tempore tenetur.
              </p>
            </Motion>
          </PopoverContent>
        </AnimatePresence>
      </PopoverPortal>
    </PopoverRoot>
</template>

Describe the bug

Expected behavior

No response

Context & Screenshots (if applicable)

No response

@MickL MickL added the bug Something isn't working label Feb 27, 2025
@zernonia zernonia linked a pull request Feb 28, 2025 that will close this issue
@zernonia
Copy link
Member

Hi @MickL ! This is because Popover renders additional div that causes the animation to not be binded correctly. Thus in 0.10.0 of motion-v we introduced a new prop that unwrap the target element.

See demo.
See docs

@MickL
Copy link
Author

MickL commented Feb 28, 2025

Thanks!!
Maybe it would be good to have all the Reka examples with animations because it can get really confusing to get them working with all those containers and as-child props.

Btw. I have one more case where it works with v-if but not with v-show. Will try to create a reproduction later.

Also I figured some animations dont work well with v-if, e.g. animating width from 0 to auto to 0. Not sure if thats a bug or not? With v-if the enter animation always starts from zero while with v-show it forwards/backwards smoothly when toggling while the animation is running.

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

Successfully merging a pull request may close this issue.

2 participants