Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

slider tooltip.always_visible doesn't position properly #751

Closed
michaelbabyn opened this issue Feb 6, 2020 · 5 comments · Fixed by #878
Closed

slider tooltip.always_visible doesn't position properly #751

michaelbabyn opened this issue Feb 6, 2020 · 5 comments · Fixed by #878
Assignees
Milestone

Comments

@michaelbabyn
Copy link

If I put a slider into a div that has overflow-y=scroll, then the tooltip doesn't scoll with the slider

Screenshot from 2020-02-06 13-05-47

import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash(
    __name__,
)


app.layout = html.Div([
    html.Div([
        html.Div(dcc.Slider(
            min=0,
            max=100,
            value=65,
            tooltip={'always_visible':True, 'placement':'bottom'}
        ),
        style=dict(height=100))
    ]*5,
    style=dict(maxHeight=300, overflowX='scroll'))
])


if __name__ == '__main__':
    app.run_server(debug=True)
@wbrgss
Copy link
Contributor

wbrgss commented Feb 6, 2020

possible related to react-component/slider/issues/374

@alb-erandelcastillo
Copy link

Since dcc.Slider is calling the react tooltip API, what would be the correct container to set for the tooltip when using getTooltipContainer?

@Marc-Andre-Rivet Marc-Andre-Rivet added this to the OSS milestone Aug 4, 2020
@wbrgss
Copy link
Contributor

wbrgss commented Aug 28, 2020

There is a fix here in the original/official version of this repo: ant-design/ant-design#16717. We could make a PR onto react-component/slider upstream or try to migrate dcc.Slider to the original (https://github.com/ant-design/ant-design/tree/master/components/slider) (cc @chriddyp if you were planning to take a look at this)

@wbrgss
Copy link
Contributor

wbrgss commented Aug 28, 2020

A short term fix would be to document around it with the suggestion here react-component/slider#374 (comment)

getTooltipContainer works as long as the slider has a parent that has position relative

@jdamiba
Copy link
Contributor

jdamiba commented Oct 14, 2020

I'm currently taking a look at this. This is a non-exhaustive list of some things I'm in the process of figuring out:

  • what combination of css rules is leading to this?
    • the tooltips are positioned absolutely in divs that are siblings of the react-entry-point div and have the following style:
position: absolute;
top: 0px;
left: 0px;
width: 100%;
  • identify a combination of css rules that lead to the desired behavior - presumably the tooltip should only be visible when parent slider is visible and the tooltip should scroll with the parent slider has the overflow=y style?
    • make sure the tooltips are relatively placed in the right place in the DOM- they should be children of the slider rc-slider element?
    • make sure they aren't visible if the parent isn't visible
  • understand how this bug was fixed in the ant-design component
    • they added a getPopupContainer prop to their slider, which binds the tooltip to document.body()
  • determine how to update dcc_slider to implement the desired behavior - patch dcc_slider or migrate it entirely to another implementation?
Function returning html node which will act as tooltip container. By default the tooltip attaches to the body. If you want to change the container, simply return a new element.
  • could be that we need to make the same edit that the ant component made

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.