Skip to content

fix RangeSlider allow_cross - #3926

Open
Sasha-P wants to merge 1 commit into
plotly:devfrom
Sasha-P:dev
Open

fix RangeSlider allow_cross#3926
Sasha-P wants to merge 1 commit into
plotly:devfrom
Sasha-P:dev

Conversation

@Sasha-P

@Sasha-P Sasha-P commented Jul 29, 2026

Copy link
Copy Markdown

Fix RangeSlider crossing and interaction synchronization

Summary

This PR fixes dcc.RangeSlider interaction regressions around allowCross,
updatemode, direct input, and thumb identity.

  • Enforce allowCross=False consistently for pointer, keyboard, Home/End, and
    direct-input changes.
  • Preserve the existing default behavior of allowCross=True when the prop is
    omitted, while publishing crossed values in canonical ascending order.
  • Keep drag_value live during updatemode="mouseup" interactions and publish
    value only when the interaction commits.
  • Track the logical active thumb through crossings, duplicate values, track
    clicks, and mixed pointer/keyboard input.
  • Synchronize direct-input drafts and active interactions when an authoritative
    external value update arrives, including when the number of handles changes.
  • Resynchronize value and drag_value after direct-input blur, including when
    the constrained result returns to the interaction's starting value.

No public API is added or removed. The changes make the existing allowCross
and updatemode contracts behave consistently across all input methods.

Implementation notes

  • Introduced explicit pointer and keyboard interaction transactions so
    mouseup commits use the interaction's authoritative start and final values.
  • Added stable, tagged sorting to retain active-thumb identity while values
    cross or become equal.
  • Matched Radix Slider's pointer-to-thumb selection, including first-thumb tie
    resolution for duplicate values, horizontal/vertical orientation, and
    reversed sliders.
  • Added step-aware Home/End handling and prevented the custom keyboard path from
    updating disabled sliders.
  • Added local-value echo tracking so component-originated setProps updates are
    distinguished from same-value authoritative external updates.
  • Reworked direct-input editing to retain temporary text while editing and
    publish constrained, canonical values at the correct update boundary.

Test coverage

Added a focused 15-test Firefox integration suite covering:

  • click and direct-input callbacks;
  • crossing and clamping with explicit and default allowCross;
  • drag and mouseup update modes;
  • mouseup release commits and mixed pointer/keyboard gestures;
  • keyboard clamping, Home/End, off-step endpoints, and disabled sliders;
  • equal and duplicate thumb identity in both movement directions;
  • no-op track starts and duplicate-value tie selection;
  • external value updates, stale direct-input drafts, and handle-count shrink;
  • drag_value resynchronization after direct-input blur.

The existing keyboard-input test now sets allowCross=False explicitly where it
asserts no-cross behavior.

Verification

../.venv/bin/python -m pytest \
  components/dash-core-components/tests/integration/sliders/test_rangeslider_allow_cross.py \
  --webdriver Firefox --headless -xvs

15 passed
npm run build:js

webpack 5.104.1 compiled with 2 asset-size warnings

Additional checks:

  • Black: passed
  • Prettier: passed
  • ESLint: 0 errors (one pre-existing unused count warning)
  • git diff --check: passed
  • Chromium browser smoke test using manual_rangeslider_allow_cross.py: passed

Contributor Checklist

  • I have broken down my PR scope into the following tasks
    • Fix RangeSlider crossing and interaction lifecycle behavior
    • Synchronize direct inputs and external prop updates
    • Preserve thumb identity across duplicate and crossed values
    • Add regression coverage for all fixed interaction paths
  • I have run the tests locally and they passed.
  • I have added tests, or extended existing tests, to cover the bugs fixed in
    this PR.

Optionals

  • I have added an entry in CHANGELOG.md.
  • This PR requires a follow-up in Dash documentation or a community thread.

@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant