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

Tooltip should be rendered in the document body instead of just outside of div

Open akashishu777 opened this issue 7 years ago • 7 comments

Currently, the tooltip is get rendered in this way

<body>
    <div>
        <span class="dragitem" id="test">hello</span>                         //main element
        <div> class="sc-dnqmqq fOiqOs" offset="8" open>Tooltip</div>         //tooltip 
    </div>
<body/> 

But in this case, if there is some other div are present before after then some portion of the tooltip cuts off.

In order to fix this, I think you need to render you tooltip every time just before the document body gets the end.

<html>
<body>
  <div>
     <span class="dragitem" id="test">hello</span>     //main element
  </div>
</body>

<div> class="tooltip" offset="8" open>Tooltip</div>    //tooltip
</html>

For your reference: http://jamesknelson.com/rendering-react-components-to-the-document-body/

akashishu777 avatar Nov 09 '18 05:11 akashishu777

What do you mean by "The tooltip cuts off"? Do you a a visual?

cedricdelpoux avatar Nov 09 '18 08:11 cedricdelpoux

Have a look url

akashishu777 avatar Nov 09 '18 11:11 akashishu777

why not specify an overflow: visible on your component ?

cedricdelpoux avatar Nov 12 '18 20:11 cedricdelpoux

Hi @xuopled It doesn't work, and it will not until we render our tooltip outside the parent div and inside the body tag as I have mentioned in my comment https://github.com/xuopled/react-simple-tooltip/issues/13#issue-379026010

This is the issue! screenshot 396

akashishu777 avatar Nov 13 '18 07:11 akashishu777

Ok I understand. The problem is that the tooltip is positioned relatively to the component attached to it. If the tooltip is render before the end of the body, I will not be possible anymore.

I open to a pull request if you success to do what you need without changing the tooltip behavior

cedricdelpoux avatar Nov 13 '18 09:11 cedricdelpoux

any update?

cristian-sima avatar Jan 06 '23 17:01 cristian-sima

If you want to help me with a PR, please do

cedricdelpoux avatar Jan 08 '23 08:01 cedricdelpoux