Skip to content

Commit

Permalink
Move SliderRoot.onValueChange's activeThumbIndex to third position
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak committed Nov 19, 2024
1 parent 38afd34 commit 76f5098
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/mui-base/src/Slider/Root/SliderRoot.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ describeSkipIf(typeof Touch === 'undefined')('<Slider.Root />', () => {
});

it('should pass "name" and "value" as part of the event.target for onValueChange', async () => {
const handleValueChange = stub().callsFake((newValue, thumbIndex, event) => event.target);
const handleValueChange = stub().callsFake((newValue, event) => event.target);

const { getByRole } = await render(
<TestSlider onValueChange={handleValueChange} name="change-testing" value={3} />,
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-base/src/Slider/Root/useSliderRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export function useSliderRoot(parameters: useSliderRoot.Parameters): useSliderRo
value: { value, name },
});

onValueChange(value, thumbIndex, clonedEvent);
onValueChange(value, clonedEvent, thumbIndex);
},
[name, onValueChange],
);
Expand Down Expand Up @@ -546,7 +546,7 @@ export namespace useSliderRoot {
* You can pull out the new value by accessing `event.target.value` (any).
* **Warning**: This is a generic event not a change event.
*/
onValueChange?: (value: number | number[], activeThumb: number, event: Event) => void;
onValueChange?: (value: number | number[], event: Event, activeThumbIndex: number) => void;
/**
* Callback function that is fired when the `pointerup` is triggered.
*
Expand Down

0 comments on commit 76f5098

Please sign in to comment.