Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touchend firing twice (I think) #361

Closed
sciku1 opened this issue Nov 15, 2017 · 5 comments
Closed

Touchend firing twice (I think) #361

sciku1 opened this issue Nov 15, 2017 · 5 comments

Comments

@sciku1
Copy link

sciku1 commented Nov 15, 2017

I've got this piece of code:

class PriceFilter extends Component {
    onChange(price) {
        this.props.store.filters.price_max = price;
    }
    render() {
        return (
            <div className="price-filter">
                <Slider
                    min={0}
                    max={2500}
                    step={10}
                    defaultValue={2000}
                    onChange={this.onChange.bind(this)}
                    onAfterChange={this.props.reload.bind(this)}
                />
                <div className="min">$1</div>
                <div className="max">$2500+</div>
            </div>
        );
    }
}

On mobile, if I tap instead of drag the slider afterChange gets called twice. I believe this is a bug.

@Robin-front
Copy link
Contributor

duplicate onMouseUp cause twice this.onEnd invoked and twice afterChange

@yesmeck
Copy link
Member

yesmeck commented Feb 27, 2018

@sciku1 Try 8.6.1

@yesmeck yesmeck closed this as completed Feb 27, 2018
@abhijit-padhy
Copy link

abhijit-padhy commented Jan 26, 2019

@yesmeck I am using 8.6.4. Still onAfterChange is fired twice. Can you put a stopPraopagation event inside this.onEnd?

@brinley
Copy link

brinley commented Jan 30, 2019

I just noticed the issue as well on 8.6.4. From what i can see onAfterChange is fired again from onEnd when the slider loses focus https://github.com/react-component/slider/blob/master/src/Slider.jsx#L97
I don't believe adding stopPropagation will resolve the issue. Do we even need to call onAfterChange in onEnd when onAfterChange is already fired on touchend/mouseup?

@dangnelson
Copy link

I'm experiencing this issue in 8.6.9 which is causing the slider to pop back to the initial value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants