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

make sure tooltips aren't visible when parent slider isn't #878

Merged
merged 6 commits into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- [#871](https://github.com/plotly/dash-core-components/pull/871) Add Julia syntax highlighting support for dcc.Markdown

## Updated
- [#878](https://github.com/plotly/dash-core-components/pull/878)
- Fixed [#751](https://github.com/plotly/dash-core-components/issues/751), a bug that causes `dcc.Slider` and `dcc.RangerSlider` tooltips to be visible even if the slider component isn't visible (e.g. overflow),
- [#875](https://github.com/plotly/dash-core-components/pull/875)
- Upgraded Plotly.js to [1.57.1](https://github.com/plotly/plotly.js/releases/tag/v1.57.1)
- Patch release [1.57.1](https://github.com/plotly/plotly.js/releases/tag/v1.57.1)
Expand Down
10 changes: 9 additions & 1 deletion src/fragments/Slider.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,15 @@ export default class Slider extends Component {
setProps({value});
}
}}
tipProps={tipProps}
/*
if/when rc-slider or rc-tooltip are updated to latest versions,
we will need to revisit this code as the getTooltipContainer function will need to be a prop instead of a nested property
*/
tipProps={{
...tipProps,
getTooltipContainer: node => node,
}}
style={{position: 'relative'}}
value={value}
marks={truncatedMarks}
{...omit(
Expand Down
65 changes: 65 additions & 0 deletions tests/integration/sliders/test_sliders.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,68 @@ def test_slsl004_out_of_range_marks_rangeslider(dash_dcc):
dash_dcc.start_server(app)

assert len(dash_dcc.find_elements("span.rc-slider-mark-text")) == 6


def test_slsl005_slider_tooltip(dash_dcc):
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": "top"},
),
style=dict(height=100),
),
html.Div(
dcc.Slider(
min=0,
max=100,
value=65,
tooltip={"always_visible": True, "placement": "top"},
),
style=dict(height=100),
),
html.Div(
dcc.Slider(
min=0,
max=100,
value=65,
tooltip={"always_visible": True, "placement": "top"},
),
style=dict(height=100),
),
html.Div(
dcc.Slider(
min=0,
max=100,
value=65,
tooltip={"always_visible": True, "placement": "top"},
),
style=dict(height=100),
),
html.Div(
dcc.Slider(
id="test-slider",
min=0,
max=100,
value=65,
tooltip={"always_visible": True, "placement": "top"},
),
style=dict(height=100),
),
],
style=dict(maxHeight=300, overflowX="scroll"),
)
]
)

dash_dcc.start_server(app)
dash_dcc.wait_for_element("#test-slider")
dash_dcc.percy_snapshot(
"slider-make sure tooltips are only visible if parent slider is visible"
)