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

fixes tooltips on RangeSlider #963

Merged
merged 6 commits into from
May 14, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).


## UNRELEASED

### Fixed

- [#963](https://github.com/plotly/dash-core-components/pull/963) Fixes [#885](https://github.com/plotly/dash-core-components/issues/885)

This applies the fix from [#878](https://github.com/plotly/dash-core-components/pull/878) to the RangeSlider.
It not only fixes the bug where the tooltips were visible when slider was not, but it also reduces the lag in the
tooltip when the slider handles are moved.

### Added
- [#932](https://github.com/plotly/dash-core-components/pull/932). Adds a new copy to clipboard component.
- [#948](https://github.com/plotly/dash-core-components/pull/948)] Adds `disabled_days` prop to `DatePickerRange` and `DatePickerSingle` components. With this prop you can specify days that should be made unselectable in the date picker, in addition to those that fall outside of the range specified by `min_date_allowed` and `max_date_allowed`.
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ export(dccTab)
export(dccTabs)
export(dccTextarea)
export(dccUpload)
export(dccTimer)
export(dccGeolocation)
10 changes: 9 additions & 1 deletion src/fragments/RangeSlider.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,15 @@ export default class RangeSlider 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 @@ -162,6 +162,71 @@ def test_slsl005_slider_tooltip(dash_dcc):
)


def test_slsl005_rangeslider_tooltip(dash_dcc):
app = dash.Dash(__name__)
app.layout = html.Div(
[
html.Div(
[
html.Div(
dcc.RangeSlider(
min=0,
max=100,
value=[0, 65],
tooltip={"always_visible": True, "placement": "top"},
),
style=dict(height=100),
),
html.Div(
dcc.RangeSlider(
min=0,
max=100,
value=[0, 65],
tooltip={"always_visible": True, "placement": "top"},
),
style=dict(height=100),
),
html.Div(
dcc.RangeSlider(
min=0,
max=100,
value=[0, 65],
tooltip={"always_visible": True, "placement": "top"},
),
style=dict(height=100),
),
html.Div(
dcc.RangeSlider(
min=0,
max=100,
value=[0, 65],
tooltip={"always_visible": True, "placement": "top"},
),
style=dict(height=100),
),
html.Div(
dcc.RangeSlider(
id="test-slider",
min=0,
max=100,
value=[0, 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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right - this line is failing because percy snapshot names need to be unique, this matches #878

Normally it's nice to keep these snapshot names shorter too, though of course I should have provided that feedback in #878 😉

)


def test_slsl006_drag_value_slider(dash_dcc):
app = dash.Dash(__name__)
app.layout = html.Div(
Expand Down