Skip to content

Commit

Permalink
[Slider] Set position: relative on range slider indicator (mui#1175)
Browse files Browse the repository at this point in the history
  • Loading branch information
mj12albert committed Jan 3, 2025
1 parent 7b6739b commit 2a75cf1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react/src/slider/indicator/useSliderIndicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import type { useSliderRoot } from '../root/useSliderRoot';
function getRangeStyles(orientation: useSliderRoot.Orientation, offset: number, leap: number) {
if (orientation === 'vertical') {
return {
position: 'relative',
bottom: `${offset}%`,
height: `${leap}%`,
width: 'inherit',
};
}

return {
position: 'relative',
insetInlineStart: `${offset}%`,
width: `${leap}%`,
height: 'inherit',
Expand All @@ -36,12 +38,14 @@ export function useSliderIndicator(
internalStyles = getRangeStyles(orientation, trackOffset, trackLeap);
} else if (orientation === 'vertical') {
internalStyles = {
position: 'relative',
bottom: 0,
height: `${percentageValues[0]}%`,
width: 'inherit',
};
} else {
internalStyles = {
position: 'relative',
insetInlineStart: 0,
width: `${percentageValues[0]}%`,
height: 'inherit',
Expand Down

0 comments on commit 2a75cf1

Please sign in to comment.