fix RangeSlider allow_cross - #3926
Conversation
|
|
Thanks for the PR! Could you please add some examples of the issues with screenshots and/or videos? This is a lot of code to review and the examples would help us target our review. |
|
@camdecoster description updated. added |
|
Thanks. One last request: could you please open an issue that this PR closes? It's part of our record keeping process. Our team has this in our list to look at, but it might take some time to get to. |
|
@camdecoster issue created #3935 |
KoolADE85
left a comment
There was a problem hiding this comment.
Hey @Sasha-P thank you for the PR here.
The issue you identified is actually a upstream bug in radix-ui .
They have just recently fixed this issue which should allow this entire PR to collapse down to a single line that passes our allowCross to their preserveThumbOrder:
<RadixSlider.Root
...
preserveThumbOrder={allowCross === false}
...
/>
Looks like this will be part of their 1.5.0 release (currently in pre-release).
To keep this component as simple as possible, I think the best course of action is to update this PR to require @radix-ui/react-slider 1.5.0 and then leverage your test suite to confirm that it fixes allowCross as expected.
Thanks again for your work here!



Fix RangeSlider crossing and interaction synchronization
Summary
This PR fixes
dcc.RangeSliderinteraction regressions aroundallowCross,updatemode, direct input, and thumb identity.allowCross=Falseconsistently for pointer, keyboard, Home/End, anddirect-input changes.
allowCross=Truewhen the prop isomitted, while publishing crossed values in canonical ascending order.
drag_valuelive duringupdatemode="mouseup"interactions and publishvalueonly when the interaction commits.clicks, and mixed pointer/keyboard input.
external
valueupdate arrives, including when the number of handles changes.valueanddrag_valueafter direct-input blur, including whenthe constrained result returns to the interaction's starting value.
No public API is added or removed. The changes make the existing
allowCrossand
updatemodecontracts behave consistently across all input methods.Steps to reproduce
example.py
From the workspace root, check out the parent revision and start the manual
RangeSlider app:
Open http://127.0.0.1:8050 and find the
RangeSlider allowCross=False updatemode=dragexample.Drag the lower handle past the upper handle.
Before this fix, the lower handle crosses the upper handle even though
allowCross=False, and the callback value changes from[5, 15]to acrossed range such as
[15, 18].Stop the server, check out this commit, and repeat the same interaction:
After this fix, the lower handle stops at the upper handle and the callback
value remains constrained, for example
[15, 15].Before and after recording
The left panel is the parent revision (
3d3a9f70f); the right panel is thiscommit (
41cd7f87f). Both panels replay the same pointer path withallowCross=False.Implementation notes
mouseupcommits use the interaction's authoritative start and final values.cross or become equal.
resolution for duplicate values, horizontal/vertical orientation, and
reversed sliders.
updating disabled sliders.
setPropsupdates aredistinguished from same-value authoritative external updates.
publish constrained, canonical values at the correct update boundary.
Test coverage
Added a focused 15-test Firefox integration suite covering:
allowCross;dragandmouseupupdate modes;drag_valueresynchronization after direct-input blur.The existing keyboard-input test now sets
allowCross=Falseexplicitly where itasserts no-cross behavior.
Verification
Additional checks:
countwarning)git diff --check: passedmanual_rangeslider_allow_cross.py: passedContributor Checklist
this PR.
Optionals
CHANGELOG.md.