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

Doesn't work inside tables #276

Closed
franciscolourenco opened this issue May 18, 2017 · 26 comments
Closed

Doesn't work inside tables #276

franciscolourenco opened this issue May 18, 2017 · 26 comments
Assignees
Labels
bug Something is not working. Fixed in popper@2.x This issue has been fixed in version 2.x PRIORITY: medium TARGETS: core Utility functions, lifecycle, core library stuff.

Comments

@franciscolourenco
Copy link

franciscolourenco commented May 18, 2017

CodePen demo

https://codepen.io/anon/pen/RVeQyL

Steps to reproduce the problem

  1. Put reference element inside of a table
  2. Initialize Popper.js on it

What is the expected behavior?

Popper should show up next to reference element.

What went wrong?

Popper shows up in wrong location, or if page is scrolled, sometimes it gets hidden.

@franciscolourenco
Copy link
Author

EDIT: I've reproduced with popper only and switched the jsbin to codepen.

@franciscolourenco franciscolourenco changed the title Tooltip.js doesn't work inside tables Doesn't work inside tables May 19, 2017
@FezVrasta
Copy link
Member

Umh that's unexpected 🤔

@FezVrasta FezVrasta added bug Something is not working. PRIORITY: medium TARGETS: core Utility functions, lifecycle, core library stuff. labels May 19, 2017
@franciscolourenco
Copy link
Author

franciscolourenco commented May 19, 2017

@FezVrasta any clue on why this happens?

@FezVrasta
Copy link
Member

Nope, sorry but I'm not at home these days so I'm not able to investigate.

@franciscolourenco
Copy link
Author

Updated the codepen to make it more clear

@mponizil
Copy link

mponizil commented Jul 20, 2017

I'm seeing the issue as popper.offsetParent returning a grandparent with position: relative, instead of the <td> container element, and am able to work around it by setting position: relative on the <td> directly.

@franciscolourenco
Copy link
Author

@mponizil that only works partially, because the popper width will be calculated based on the width of the td, and so will be constrained if you have a lot of text and want the popper width to adjust automatically.

@mponizil
Copy link

@aristidesfl hah, indeed I realized that just after posting!

@franciscolourenco
Copy link
Author

Best workaround I've found so far:

new Tooltip({
      container: document.body,  
      boundariesElement: document.body
})

@FezVrasta
Copy link
Member

The problem is this:
image

https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent

I guess I'll have to create a custom offsetParent implementation to get rid of this quirkiness..

FezVrasta pushed a commit that referenced this issue Jul 23, 2017
FezVrasta pushed a commit that referenced this issue Jul 23, 2017
@FezVrasta
Copy link
Member

You all guys, please review #363 and let me know if it fixes your problems.

@FezVrasta FezVrasta self-assigned this Jul 24, 2017
FezVrasta pushed a commit that referenced this issue Jul 26, 2017
@FezVrasta
Copy link
Member

released as 1.11.0

@razzmatazz
Copy link

Not sure if it is a big thing to fix, but the fix in #276 doesn't work for <th> elements.

@ursuscamp
Copy link

I can verify also that this doesn't work in <th> elements. I worked around it by changing my <th> elements to <td> elements, but that does hurt my brain a bit.

@hally9k
Copy link

hally9k commented Apr 25, 2018

Agreed, this doesn't work inside <th>. Reopen!

@eliseumds
Copy link

eliseumds commented Jun 1, 2018

I have an issue with tables too. Small tooltips are correctly-positioned, but once they are a bit tall, they get mispositioned. The target is inside a TD.

Small tooltip (correct)

screen shot 2018-06-01 at 17 02 20

Big tooltip (incorrect)

screen shot 2018-06-01 at 17 02 52
screen shot 2018-06-01 at 17 02 36

Outside of the table (correct)

screen shot 2018-06-01 at 17 04 23

@simbunch
Copy link

simbunch commented Jun 5, 2018

Workaround that works for now:

<div class="table-responsive" style="margin:-200px 0;">
    <table class="table" style="padding:-200px 0;">
        <!-- popovers and tooltips inside will now work -->
    </table>
</div>

Works if container is outside of .table-responsive

asdvalenzuela added a commit to asdvalenzuela/popper.js that referenced this issue Jul 13, 2018
@florianlacreuse
Copy link

florianlacreuse commented Aug 21, 2018

We still have an issue with popover inside table wrapped in a Bootstrap table-responsive container.

I think it may be related to this issue.

FezVrasta pushed a commit that referenced this issue Aug 28, 2018
#363 fixed the positioning issue for td elements, but the problem still existed for th elements.
This PR adds a fix for th elements as well.
@florianlacreuse
Copy link

Update: my issue seems more related to issue #611.

@FezVrasta
Copy link
Member

These issues should be fixed in v2, I don't have any codepen to test it (since the recent examples rely on Bootstrap), but similar table-related issues are fixed so I'm pretty confident.

@FezVrasta FezVrasta added the Fixed in popper@2.x This issue has been fixed in version 2.x label Dec 16, 2019
@yanghoxom
Copy link

Best workaround I've found so far:

new Tooltip({
      container: document.body,  
      boundariesElement: document.body
})

for v1, this is solutions

@Michael101sh
Copy link

Michael101sh commented May 17, 2022

Hi,
Is there a solution for v2?
I'm using it through react-popper-tooltip packge.

@atomiks
Copy link
Collaborator

atomiks commented May 17, 2022

v2 doesn't have any table issues

@Michael101sh
Copy link

Michael101sh commented May 17, 2022

Actually, there is, I tried to combine the tooltip in a simple HTML table and it didn't work, but when I changed from <td> to <div> it worked.

@Michael101sh
Copy link

Ok, I found the problem: overflow: hidden; (for another purpose).
Thanks @atomiks, your answer made me try again to make it work

@privatenumber
Copy link

This seems to be happening in floating-ui for me.

Wondering if #363 needs to be re-applied? I noticed the unit test is no longer there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working. Fixed in popper@2.x This issue has been fixed in version 2.x PRIORITY: medium TARGETS: core Utility functions, lifecycle, core library stuff.
Projects
None yet
Development

No branches or pull requests