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

Tooltip does not follow the position of fixed elements on scroll #25117

Closed
1 task done
micnic opened this issue Jun 19, 2020 · 5 comments
Closed
1 task done

Tooltip does not follow the position of fixed elements on scroll #25117

micnic opened this issue Jun 19, 2020 · 5 comments

Comments

@micnic
Copy link

micnic commented Jun 19, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://codepen.io/micnic/pen/XWXpaGv

Steps to reproduce

  1. Put the cursor over the first text so that the tooltip appears
  2. Start scrolling while keeping the cursor over the text with tooltip

What is expected?

It is expected that the tooltip does not move while scrolling because the element has the css position fixed.

What is actually happening?

While scrolling the tooltip follows the scroll position and is not displayed near the element that triggered the tooltip.

Environment Info
antd 4.3.4
React any
System any
Browser any
@afc163 afc163 closed this as completed Jun 19, 2020
@yaronya
Copy link

yaronya commented Dec 9, 2020

Hey @afc163
I don't think this PR should be closed as:

  1. The attached doc link doesn't include any reference that this is also an issue of the Tooltip component.
  2. I've tried to fix this via the suggested solution (getPopupContainer) and it doesn't work.

@thangdev
Copy link

thangdev commented Jul 5, 2021

@yaronya , Hey you can add getPopupContainer inside Tooltip tag like this. It works for me :)
<Tooltip getPopupContainer={triggerNode => triggerNode.parentNode} />

@kaushik-asahi
Copy link

kaushik-asahi commented Oct 13, 2021

@yaronya , Hey you can add getPopupContainer inside Tooltip tag like this. It works for me :)

I tried getPopupContainer workaround, but i couldn't change the placement (i.e. even if i specify placement=top, it behaves like placement=bottom). But it does fix the popup moving along the scroll issue.

@DevRichter
Copy link

@yaronya , Hey you can add getPopupContainer inside Tooltip tag like this. It works for me :)

I tried getPopupContainer workaround, but i couldn't change the placement (i.e. even if i specify placement=top, it behaves like placement=bottom). But it does fix the popup moving along the scroll issue.

you can add a relative position to the .ant-tooltip-inner and move it with the left right top bottom props wherever you want to it be :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants