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

Slider on:input event #1643

Closed
Tracked by #1621
AZProductions opened this issue Jan 29, 2023 · 2 comments · Fixed by #1906
Closed
Tracked by #1621

Slider on:input event #1643

AZProductions opened this issue Jan 29, 2023 · 2 comments · Fixed by #1906
Labels
bug Something isn't working
Milestone

Comments

@AZProductions
Copy link

Could there be a on:input event implemented in the Slider component. I'm running into problems where on:change gets fired when the user moves the slider, and when the slider value changes. I only want the event to fire when the user moves the slider.

I recreated a demo here:
https://svelte.dev/repl/10aa153589364fddbccb7ec765bde60e?version=3.55.1

Hope it's clear enough, thank you!

@theetrain
Copy link
Collaborator

Thanks for pointing this out. Slider, like a few other components, are dispatching change reactively when it shouldn't. The problematic code is here:

if (!holding && !disabled) {
dispatch("change", value);
}

We're looking to standardize events (see #1621) and it probably makes sense to forward the native change event if one exists, rather than dispatch it manually. Let us know if you're willing to contribute a fix, otherwise we'll have this ready for v1.

@theetrain theetrain added the bug Something isn't working label Jan 29, 2023
@theetrain theetrain added this to the v1.0.0 milestone Jan 29, 2023
metonym pushed a commit to mmamedel/carbon-components-svelte that referenced this issue Feb 11, 2024
metonym pushed a commit that referenced this issue Feb 11, 2024
Fixes #1643

The dispatched `on:change` event in `Slider` only fires when the slider thumb is released. `on:input` fires when actively dragging the thumb, and should fire on every increment (e.g., 1, 2, 3).
@metonym
Copy link
Collaborator

metonym commented Feb 12, 2024

Fixed in v0.82.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants