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

HTML comment in custom component wrapped with <transition-group> breaks transition #4830

Closed
Delicious-Bacon opened this issue Oct 21, 2021 · 3 comments
Labels
has workaround A workaround has been found to avoid the problem 🐞 bug Something isn't working 🔩 p2-edge-case scope: transition

Comments

@Delicious-Bacon
Copy link

Version

3.2.20

Reproduction link

sfc.vuejs.org/

Steps to reproduce

Open the link and click the "Toggle transition" button.

What is expected?

Expected normal transition behavior.

What is actually happening?

Transition-group throws an error:

TypeError: child.el.getBoundingClientRect is not a function

I've added the <!--This comment breaks it--> HTML comment in CustomComponent.vue. Remove it and the transition will work.

I assume Vue reads the HTML comment as the second template's root element.

Had problem with this for hours because I left one HTML tag commented out in my component. Figured it out by sheer luck. >_>

@edison1105 edison1105 added 🐞 bug Something isn't working scope: transition labels Oct 22, 2021
@ShroXd
Copy link
Contributor

ShroXd commented Oct 22, 2021

A component in <Transition> should have a root tag so that it can be animated.
If you change the comment to <div>Hello World</div>, you will see the correct warning message. So maybe we have two works :

  1. Fix the error catch when component inside don't have a root node and have a comment
  2. We do allow users to implement multiple root nodes component in Vue3, but it seems doesn't work when we wrap it with a <Transition> tag 🤔

@posva posva added has workaround A workaround has been found to avoid the problem 🔩 p2-edge-case labels Oct 22, 2021
@stuta
Copy link

stuta commented Feb 27, 2022

Please print a warning if the template has html comment in it. I spent 6 hours figuring out this problem. Or remove automatically all html comments from translation templates.

I got these errors: #4621.

@edison1105
Copy link
Member

Closing as it had been fixed via #9421

@edison1105 edison1105 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 3, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has workaround A workaround has been found to avoid the problem 🐞 bug Something isn't working 🔩 p2-edge-case scope: transition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants