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

Placement is not working properly in tables

Open phibersoft opened this issue 1 year ago • 6 comments

Describe the bug I'm passing "top" as prop, but its returning and showing on "bottom". I tested on codesandbox with your official demo, it looks like working good, but in my app its not working. The only difference is im using this tooltip in table header, maybe its related to this.

Reproduce Check codesandbox link: https://codesandbox.io/s/ancient-bush-exyt8r?file=/src/index.js

Screenshots image

Additional Context Placement is working fine on left-right-bottom. Its only occuring on top.

phibersoft avatar Apr 16 '23 00:04 phibersoft

Could you please share a codesandbox reproducer with that table header usage?

mohsinulhaq avatar Apr 16 '23 07:04 mohsinulhaq

Here it is: https://codesandbox.io/s/ancient-bush-exyt8r?file=/src/index.js

phibersoft avatar Apr 16 '23 19:04 phibersoft

It is not enough space for top, also thinking how to fix it. Strange why it is changing to bottom if it is absolute. @mohsinulhaq maybe you can help?

happylolonly avatar Jul 11 '23 13:07 happylolonly

Its not the solution but i solved like this:

Create an empty div before table, set width 100%

<div id='tooltip-bar' style={{ width: '100%' }} />
<table ...

And in the header cells, use createPortal and teleport your component to #tooltip-bar. In this way it works normally and looks fine.

phibersoft avatar Jul 11 '23 13:07 phibersoft

oh... 😅

found that this issue not depend on this lib, https://github.com/floating-ui/react-popper/issues/383

happylolonly avatar Jul 11 '23 13:07 happylolonly

Ah okay, thanks for informing 😃

phibersoft avatar Jul 11 '23 13:07 phibersoft