Skip to content

Commit

Permalink
[base-ui][useSlider] rearrange passive option in eventlisteners (mui#…
Browse files Browse the repository at this point in the history
…40235)

Co-authored-by: Ragim Musakaev <[email protected]>
  • Loading branch information
Kamino0 and Ragim Musakaev authored Dec 27, 2023
1 parent e2c3884 commit cfbf83e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/mui-base/src/useSlider/useSlider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,8 @@ export function useSlider(parameters: UseSliderParameters): UseSliderReturnValue

moveCount.current = 0;
const doc = ownerDocument(sliderRef.current);
doc.addEventListener('touchmove', handleTouchMove);
doc.addEventListener('touchend', handleTouchEnd);
doc.addEventListener('touchmove', handleTouchMove, { passive: true });
doc.addEventListener('touchend', handleTouchEnd, { passive: true });
});

const stopListening = React.useCallback(() => {
Expand All @@ -555,10 +555,7 @@ export function useSlider(parameters: UseSliderParameters): UseSliderReturnValue
});

return () => {
// @ts-ignore
slider!.removeEventListener('touchstart', handleTouchStart, {
passive: doesSupportTouchActionNone(),
});
slider!.removeEventListener('touchstart', handleTouchStart);

stopListening();
};
Expand Down Expand Up @@ -602,7 +599,7 @@ export function useSlider(parameters: UseSliderParameters): UseSliderReturnValue

moveCount.current = 0;
const doc = ownerDocument(sliderRef.current);
doc.addEventListener('mousemove', handleTouchMove);
doc.addEventListener('mousemove', handleTouchMove, { passive: true });
doc.addEventListener('mouseup', handleTouchEnd);
};

Expand Down

0 comments on commit cfbf83e

Please sign in to comment.