react-tooltip icon indicating copy to clipboard operation
react-tooltip copied to clipboard

Tooltip crops if renders in `Overflow: hidden` element

Open wamujlb opened this issue 7 years ago • 5 comments

Hi. This is too big problem if you render tooltip inside an element which has prop - overflow: hidden. image

wamujlb avatar Dec 14 '17 09:12 wamujlb

ran up against this as well - has anyone come up with a work around for this?

uxtx avatar Jan 17 '18 22:01 uxtx

@uxtx , do you have some ideas how to fix it?

wamujlb avatar Jan 18 '18 09:01 wamujlb

That's what overflow: hidden does. Either make the overflow visible or put the tooltip in a parent view. Or place it at the end of the body element using Portals.

Tarpsvo avatar Feb 27 '18 13:02 Tarpsvo

You can also use this useful HOC which appends a React component to the body element:

https://github.com/jpgorman/react-append-to-body

tonix-tuft avatar Aug 14 '19 09:08 tonix-tuft

This can be fixed this by placing an empty div in your body and using portals:

const tooltipContainer = document.getElementById("tooltip-container")
<div>
  <a data-tip data-for="my-tooltip">
    <Icon />
  </a>
  {ReactDOM.createPortal(
    <ReactTooltip
      id="my-tooltip"
      {...props}
    >
      Some tooltip content
    </ReactTooltip>,
    tooltipContainer
  )}
</div>

nmartinezb3 avatar Dec 23 '21 17:12 nmartinezb3