Skip to content

Commit

Permalink
[Slider] Fix discrete mark highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulises Lara committed Dec 27, 2019
1 parent fec696d commit 6632abd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/material-ui/src/Slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,11 +746,15 @@ const Slider = React.forwardRef(function Slider(props, ref) {
if (track === false) {
markActive = values.indexOf(mark.value) !== -1;
} else {
const isMarkActive = range
? mark.value >= values[0] && mark.value <= values[values.length - 1]
: mark.value <= values[0];
markActive =
(isMarkActive && track === 'normal') || (!isMarkActive && track === 'inverted');
(track === 'normal' &&
(range
? mark.value >= values[0] && mark.value <= values[values.length - 1]
: mark.value <= values[0])) ||
(track === 'inverted' &&
(range
? mark.value <= values[0] || mark.value >= values[values.length - 1]
: mark.value >= values[0]));
}

return (
Expand Down

0 comments on commit 6632abd

Please sign in to comment.