react-spectrum
701cf941 - A few tweaks and fixes to slider: (#955)

Commit
5 years ago
A few tweaks and fixes to slider: (#955) * A few tweaks and fixes to slider: * state needs to know which thumbs are editable, so that it can block edits to uneditable thumbs by track-dragging * make track-dragging less fragile. Previously, it only handles drag events on itself, not its children; you are expected to place the track DOM by itself, with no children, so that the drag events on the track element and the thumb elements don't conflict. Now, we keep track of whether we are dragging by track; if so, the thumb drag events won't do anything. This makes how you structure your DOM less strict; you can put the trackProps on an element by itself, or on the container of the thumbs. The Story*Slider components have been updated to show the different variations. * Removed unnecessary computeOffsetToValue() * Add / fix some slider tests * Move thumb editable tracking into refs * useDrag1D() ensures when descendant is dragged, ancestor is not dragged useSlider now no longer needs to do the equivalent tracking itself
Author
Parents
Loading