From 9fa9eb458a3c283db6d7cb0216df56177883f820 Mon Sep 17 00:00:00 2001 From: Brian Stone Date: Thu, 25 Apr 2019 13:04:52 -0700 Subject: [PATCH] fix: do nothing when right clicking on the slider Previously right click would behave the same as left click and would cause some strange behavior. --- src/components/ReactSlider/ReactSlider.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/ReactSlider/ReactSlider.jsx b/src/components/ReactSlider/ReactSlider.jsx index f076cb2d..44533ab1 100644 --- a/src/components/ReactSlider/ReactSlider.jsx +++ b/src/components/ReactSlider/ReactSlider.jsx @@ -422,7 +422,8 @@ class ReactSlider extends React.Component { }; onSliderMouseDown = e => { - if (this.props.disabled) { + // do nothing if disabled or right click + if (this.props.disabled || e.button === 2) { return; } this.hasMoved = false; @@ -532,7 +533,8 @@ class ReactSlider extends React.Component { // create the `mousedown` handler for the i-th thumb createOnMouseDown = i => e => { - if (this.props.disabled) { + // do nothing if disabled or right click + if (this.props.disabled || e.button === 2) { return; } const position = this.getMousePosition(e);