When after moving the Slider, my handler for onChangeCommitted fires as expected. If I move the mouse cursor outside of the browser window and then back in, it fires again.
The onChangeCommitted handler should not fire on mouseenter.
It does.
Link: https://codesandbox.io/s/create-react-app-vnp10
| Tech | Version |
|--------------|---------|
| Material-UI | v4.1.1 |
| Material-UI Labs | v4.0.0-alpha.16 |
| React | 16.8.6 |
| Firefox Dev | 68.0b10 |
| Chrome | 74.0.3729.108 |
@cdcasey Thank you for reporting the problem. I believe the fix is as simple as:
diff --git a/packages/material-ui-lab/src/Slider/Slider.js b/packages/material-ui-lab/src/Slider/Slider.js
index 9fde8f282..6e1e708a1 100644
--- a/packages/material-ui-lab/src/Slider/Slider.js
+++ b/packages/material-ui-lab/src/Slider/Slider.js
@@ -533,6 +533,7 @@ const Slider = React.forwardRef(function Slider(props, ref) {
touchId.current = undefined;
document.body.removeEventListener('mousemove', handleTouchMove);
document.body.removeEventListener('mouseup', handleTouchEnd);
+ document.body.removeEventListener('mouseenter', handleMouseEnter);
document.body.removeEventListener('touchmove', handleTouchMove);
document.body.removeEventListener('touchend', handleTouchEnd);
});
Do you want to submit a pull request? :) We would love to review it.
Will do!
Most helpful comment
@cdcasey Thank you for reporting the problem. I believe the fix is as simple as:
Do you want to submit a pull request? :) We would love to review it.