Repository navigation
Description
dash 4.5.2 (editable source checkout)
- Reproduced at commit:
62d468184041dbe8a75cdda132d010626f0b7335(dev).RangeSlider.tsxis the same there as in the 4.5.2 release. - OS: Ubuntu 26.04.1 LTS
- Browser: Google Chrome 158.0.8127.88
The bug
dcc.RangeSlider shows a number input for each end of the range. When a number typed into one input is past the other handle, the slider puts the handle back next to the other one on blur, but the callbacks get a pair that is out of order.
For a slider at [5, 15], type 18 into the left input and press Tab. The slider and both inputs show [15, 15]. The callback gets:
updatemode |
value |
drag_value |
|---|---|---|
"drag" |
[18, 15] |
[18, 15] |
"mouseup" |
[15, 15] |
[18, 15] |
The right input does the same in the other direction. Typing 3 into it gives [5, 3] in the same three cells, while the slider shows [5, 5].
allowCross makes no difference. I get the same output with allowCross=True and allowCross=False.
I found this while testing #3926. That PR does not fix it, because the inputs do not go through Radix.
Minimal reproducible example
from dash import Dash, Input, Output, dcc, html
app = Dash(__name__)
app.layout = html.Div(
style={"margin": "80px auto", "width": "500px"},
children=[
dcc.RangeSlider(
id="range-slider",
min=0,
max=20,
step=1,
value=[5, 15],
updatemode="drag",
),
html.Pre(id="range-output", style={"marginTop": "40px"}),
],
)
@app.callback(
Output("range-output", "children"),
Input("range-slider", "value"),
Input("range-slider", "drag_value"),
)
def show_values(value, drag_value):
return f"value={value}\ndrag_value={drag_value}"
if __name__ == "__main__":
app.run()Steps to reproduce
-
Run the example and open http://127.0.0.1:8050.
-
Click the left number input, replace
5with18, and press Tab. -
The slider and the inputs show 15 and 15, but the page reports:
value=[18, 15] drag_value=[18, 15] -
Change
updatemodeto"mouseup"and repeat. The page reports:value=[15, 15] drag_value=[18, 15]
Expected behavior
The props should match what the slider shows. After Tab, in both update modes:
value=[15, 15]
drag_value=[15, 15]
No callback should get a value or drag_value whose first number is above its second.
Activity