question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use with Portals?

See original GitHub issue

Broke my head trying to figure out how to use Tippy content in react portal… Something like this isn’t working:

<Tippy
      render={attrs => (
        <div {...attrs} onClick={() => setVisible(false)}>
          {ReactDOM.createPortal(
              props.content,
              document.getElementById("root-context-menu")!,
            )}
        </div>
      )}
...> button </Tippy>

because container with absolute positioning remains outside of portal. Wrapping Tippy into portal also won’t work because I don’t want button to be in the portal. Any hints? Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mhsattariancommented, Jan 5, 2022

Hey, Sorry to open this issue again. I ran to the same issue using an interactive tippy. it doesn’t get appended to body by default. although I must say adding appendTo={document.body} solved it.

1reaction
pleerockcommented, May 4, 2020

<Tippy /> appends the content to the <body /> by default

hmm, it doesn’t… It appends into the place where its used in my case… That’s why I wanted to use portals - to prevent styles inheritance. What can I do wrong that leads to my use-case?

edit1: added a screenshot that shows its not in the body:

Screenshot 2020-05-04 18 15 46

edit2: appendTo={document.getElementById("root-context-menu")!} worked as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Portals - React
Portals provide a first-class way to render children into a DOM node that exists ... A typical use case for portals is when...
Read more >
How to use Portals - Dump Stat Adventures
A way to use portals in your games is by using a timed portal that only has a specific amount of time it...
Read more >
How to use portals in No Man's Sky - Polygon
With the correct item in your inventory, select “locate portal,” and it will show up on your map. No Man's Sky portal glyphs...
Read more >
A Guide To Portals In 'No Man's Sky Next' - Forbes
You can use a portal to find your location in the galaxy after all 16 Runes are charged. It's a good idea to...
Read more >
How to Use Multiverse Portals - Knowledgebase - Shockbyte
Making your first portal · As an operator, enter the command /mvp wand . If you do not have access to this command...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found