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

Comment inside <transition> tag breaks transition, throws warnings, in whitespace preserve mode #4637

Closed
catrope opened this issue Sep 20, 2021 · 0 comments

Comments

@catrope
Copy link
Contributor

catrope commented Sep 20, 2021

Version

3.2.12

Reproduction link

codesandbox.io

Steps to reproduce

  1. Load the CodeSandbox link. Note that there are several transition-related warnings in the console
  2. Click the button. Note that the hidden paragraph doesn't appear, and there are two more warnings in the console.

What is expected?

No warnings should be thrown on startup. When the button is clicked, the hidden text should appear.

What is actually happening?

The hidden text does not appear. The following warnings are thrown on startup:

  • Template compilation error: <Transition> expects exactly one child element or component.
  • <transition> can only be used on a single element or component. Use <transition-group> for lists.
  • Extraneous non-props attributes (class) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.
    The latter two warnings also repeat every time the button is clicked.

The comment itself isn't at fault: the comment gets filtered out by the transition code. However, there's also a whitespace-only text node between the comment and the <p>, and that doesn't get filtered out. So the <transition> tag sees that it has two children (the text node and the <p>), freaks out, and refuses to function.

This is related to #4621 and #4622, which are also about whitespace-only text nodes breaking transitions (but for <transition-group> instead of <transition>).

@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant