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

Tooltip: Warning when wrapping Tooltip with <p> tag #487

Closed
brookback opened this issue Feb 21, 2020 · 4 comments
Closed

Tooltip: Warning when wrapping Tooltip with <p> tag #487

brookback opened this issue Feb 21, 2020 · 4 comments
Labels
Type: Bug Something isn't working

Comments

@brookback
Copy link

🐛 Bug report

Current Behavior

I've got this pretty straight forward code:

<p>
   <Tooltip label="Tooltip">
      <button>Button</button>
   </Tooltip>
</p>

This actually works, but errors are printed in console:

Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>.
    in div (created by Portal)
    in Portal (created by TooltipPopup)
    in TooltipPopup (created by Tooltip)
    in Tooltip (at App.js:13)
    in p (at App.js:12)
    in div (at App.js:9)
    in App (at src/index.js:7)

I see the issue with DOM nesting of p and div tags, but I'd think that my use case – wrapping a button with Tooltip – is pretty intuitive, and it shouldn't cause errors/warnings.

Expected behavior

No errors are printed.

Reproducible example

https://codesandbox.io/s/trusting-bhabha-lfrsm

Suggested solution(s)

Additional context

Your environment

Software Name(s) Version
Reach Package tooltip 0.8.4
React 16.8.x
Browser Chrome 80.x
Assistive tech
Node
npm/yarn
Operating System macOS 10.14.x
@enforce-template-use
Copy link

Thank you for opening this issue

chaance added a commit that referenced this issue Feb 21, 2020
@chaance chaance added the Type: Bug Something isn't working label Feb 21, 2020
@chaance
Copy link
Member

chaance commented Feb 21, 2020

This is because we use a div initially in @reach/portal as a temporary mount node. I'll use a span instead and patch this up in the next release.

@chaance
Copy link
Member

chaance commented Feb 21, 2020

Fixed in 0.8.5

@chaance chaance closed this as completed Feb 21, 2020
@brookback
Copy link
Author

Super! Thanks for being so responsive! 💞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants