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

Slider tooltip in modal scrolling with page #13418

Closed
1 task
8shaks opened this issue Dec 4, 2018 · 14 comments · Fixed by #16717
Closed
1 task

Slider tooltip in modal scrolling with page #13418

8shaks opened this issue Dec 4, 2018 · 14 comments · Fixed by #16717

Comments

@8shaks
Copy link

8shaks commented Dec 4, 2018

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

Version

3.11.0

Environment

Windows 10

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Create a modal, make height larger then screen size so you are able to scroll,
create a slider with the tool tip always visible,
scroll

What is expected?

The slider tooltip should stay above the slider handle when you scroll

What is actually happening?

The tooltip is moving down the page as well when you scroll.

@orzyyyy
Copy link
Contributor

orzyyyy commented Dec 4, 2018

This may help you.

@8shaks
Copy link
Author

8shaks commented Dec 4, 2018

Where would i add this piece of code so that it makes these changes to the slider tooltip?

@orzyyyy
Copy link
Contributor

orzyyyy commented Dec 4, 2018

My fault, I confusion between Slider and Select, ignore this...

@orzyyyy
Copy link
Contributor

orzyyyy commented Dec 4, 2018

getPopupContainer is used in Tooltip, but Slider didn't pass rest attributes of props, maybe add them there?

@8shaks
Copy link
Author

8shaks commented Dec 4, 2018 via email

@spideeee
Copy link

spideeee commented Dec 4, 2018

Since the Tooltip is wrapped inside the slider and you cannot pass the getPopupContainer to it, so to fix your issue for now, you can listen to onScroll and re-render your component to update it.

<div className="App" onScroll={e => {this.setState({visible:this.state.visible})}}>
...
</div>

This will fix your issue with the current version, BTW we should add another prop to Slider named tooltipProps, so user can pass the props to Tooltip or specifically the getPopupContainer as getTooltipPopupContainer if needed.

@afc163
Copy link
Member

afc163 commented Dec 4, 2018

@spideeee
Copy link

spideeee commented Dec 4, 2018

@afc163 , I think the prop should be added as optional prop, to avoid such issues. If yes, I can raise a PR.

@8shaks
Copy link
Author

8shaks commented Dec 4, 2018

Thanks, I was playing around with the temporary solution. It works great for desktop screens, but I noticed for mobile screens the Tooltip lags behind, and it takes a second or two for it to return to it's expected position above the Slider Handle when the user scrolls. Is there any work around to fix this?

@IssueHuntBot
Copy link

@issuehuntfest has funded $20.00 to this issue. See it on IssueHunt

@dooleyb1
Copy link

dooleyb1 commented Apr 1, 2020

This is still occurring for me

@yoyo837
Copy link
Contributor

yoyo837 commented Apr 1, 2020

@dooleyb1 Please feel free to open a new issue.

@8shaks
Copy link
Author

8shaks commented Apr 1, 2020

Hey, my fix to the solution was to add this prop to the Slider

getTooltipPopupContainer={() => document.querySelector(".ant-slider-step")}

Should work correctly with that.

@dooleyb1
Copy link

dooleyb1 commented Apr 1, 2020

Hey, my fix to the solution was to add this prop to the Slider

getTooltipPopupContainer={() => document.querySelector(".ant-slider-step")}

Should work correctly with that.

That worked perfectly, thank you!

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